diff options
138 files changed, 1924 insertions, 1061 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4a831702d7..b060ba35e3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,16 +7,14 @@ on: tags: ["Second_Life*"] jobs: - # The whole point of the setvar job is that we want to set a variable once - # that will be consumed by multiple subsequent jobs. We tried setting it in - # the global env, but a job.env can't directly reference the global env - # context. - setvar: + # The whole point of the setup job is that we want to set variables once + # that will be consumed by multiple subsequent jobs. + setup: runs-on: ubuntu-latest outputs: release_run: ${{ steps.setvar.outputs.release_run }} - branch: ${{ steps.which-branch.outputs.branch }} - relnotes: ${{ steps.which-branch.outputs.relnotes }} + configurations: ${{ steps.setvar.outputs.configurations }} + bugsplat_db: ${{ steps.setvar.outputs.bugsplat_db }} env: # Build with a tag like "Second_Life#abcdef0" to generate a release page # (used for builds we are planning to deploy). @@ -26,43 +24,38 @@ jobs: # it always evaluates as true because it's a non-empty string either way. # When you want to use a string variable as a workflow YAML boolean, it's # important to ensure it's the empty string when false. If you omit || '', - # its value when false is "false", which (again) is interpreted as true. - RELEASE_RUN: ${{ (github.event.inputs.release_run != 'false' || (github.ref_type == 'tag' && startsWith(github.ref_name, 'Second_Life'))) && 'Y' || '' }} + # its value when false is "false", which is interpreted as true. + RELEASE_RUN: ${{ (github.event.inputs.release_run || github.ref_type == 'tag' && startsWith(github.ref_name, 'Second_Life')) && 'Y' || '' }} + FROM_FORK: ${{ github.event.pull_request.head.repo.fork }} steps: - - name: Set Variable + - name: Set Variables id: setvar shell: bash run: | echo "release_run=$RELEASE_RUN" >> "$GITHUB_OUTPUT" - - name: Determine source branch - id: which-branch - uses: secondlife/viewer-build-util/which-branch@v2 - with: - token: ${{ github.token }} - + if [[ "$FROM_FORK" == "true" ]]; then + # PR from fork; don't build with Bugsplat, proprietary libs + echo 'configurations=["ReleaseOS"]' >> $GITHUB_OUTPUT + echo "bugsplat_db=" >> $GITHUB_OUTPUT + else + echo 'configurations=["Release"]' >> $GITHUB_OUTPUT + echo "bugsplat_db=SecondLife_Viewer_2018" >> $GITHUB_OUTPUT + fi build: - needs: setvar + needs: setup strategy: matrix: runner: [windows-large, macos-12-xl, linux-large] - configuration: [Release, ReleaseOS] - Linden: [true] - include: - - runner: macos-12-xl - developer_dir: "/Applications/Xcode_14.0.1.app/Contents/Developer" - exclude: - - runner: windows-large - configuration: ReleaseOS - - runner: macos-12-xl - configuration: ReleaseOS - - runner: linux-large - configuration: Release + configuration: ${{ fromJSON(needs.setup.outputs.configurations) }} runs-on: ${{ matrix.runner }} outputs: viewer_channel: ${{ steps.build.outputs.viewer_channel }} viewer_version: ${{ steps.build.outputs.viewer_version }} - imagename: ${{ steps.build.outputs.imagename }} + viewer_branch: ${{ steps.which-branch.outputs.branch }} + relnotes: ${{ steps.which-branch.outputs.relnotes }} + imagename: ${{ steps.build.outputs.imagename }} + configuration: ${{ matrix.configuration }} env: AUTOBUILD_ADDRSIZE: 64 AUTOBUILD_BUILD_ID: ${{ github.run_id }} @@ -75,12 +68,9 @@ jobs: # autobuild-package.xml. AUTOBUILD_VCS_INFO: "true" AUTOBUILD_VSVER: "170" - DEVELOPER_DIR: ${{ matrix.developer_dir }} + DEVELOPER_DIR: "/Applications/Xcode_14.0.1.app/Contents/Developer" # Ensure that Linden viewer builds engage Bugsplat. - BUGSPLAT_DB: ${{ matrix.Linden && 'SecondLife_Viewer_2018' || '' }} - # Run BUILD steps for Release configuration. - # Run BUILD steps for ReleaseOS configuration only for release runs. - BUILD: ${{ (matrix.Linden || needs.setvar.outputs.release_run) && 'Y' || '' }} + BUGSPLAT_DB: ${{ needs.setup.outputs.bugsplat_db }} build_coverity: false build_log_dir: ${{ github.workspace }}/.logs build_viewer: true @@ -99,19 +89,16 @@ jobs: variants: ${{ matrix.configuration }} steps: - name: Checkout code - if: env.BUILD uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup python - if: env.BUILD uses: actions/setup-python@v5 with: python-version: "3.11" - name: Checkout build variables - if: env.BUILD uses: actions/checkout@v4 with: repository: secondlife/build-variables @@ -119,19 +106,16 @@ jobs: path: .build-variables - name: Checkout master-message-template - if: env.BUILD uses: actions/checkout@v4 with: repository: secondlife/master-message-template path: .master-message-template - name: Install autobuild and python dependencies - if: env.BUILD run: pip3 install autobuild llsd - name: Cache autobuild packages id: cache-installables - if: env.BUILD uses: actions/cache@v4 with: path: .autobuild-installables @@ -152,12 +136,17 @@ jobs: llvm mold libpipewire-0.3-dev - name: Install windows dependencies - if: env.BUILD && runner.os == 'Windows' + if: runner.os == 'Windows' run: choco install nsis-unicode + - name: Determine source branch + id: which-branch + uses: secondlife/viewer-build-util/which-branch@v2 + with: + token: ${{ github.token }} + - name: Build id: build - if: env.BUILD shell: bash env: AUTOBUILD_VCS_BRANCH: ${{ needs.setvar.outputs.branch }} @@ -290,7 +279,7 @@ jobs: echo "artifact=$RUNNER_OS$cfg_suffix" >> $GITHUB_OUTPUT - name: Upload executable - if: (matrix.Linden && steps.build.outputs.viewer_app) || runner.os == 'Linux' + if: matrix.configuration == 'Release' && steps.build.outputs.viewer_app uses: actions/upload-artifact@v4 with: name: "${{ steps.build.outputs.artifact }}-app" @@ -301,15 +290,13 @@ jobs: # The other upload of nontrivial size is the symbol file. Use a distinct # artifact for that too. - name: Upload symbol file - if: matrix.Linden uses: actions/upload-artifact@v4 + if: matrix.configuration == 'Release' with: name: "${{ steps.build.outputs.artifact }}-symbols" - path: | - ${{ steps.build.outputs.symbolfile }} + path: ${{ steps.build.outputs.symbolfile }} - name: Upload metadata - if: matrix.Linden uses: actions/upload-artifact@v4 with: name: "${{ steps.build.outputs.artifact }}-metadata" @@ -320,7 +307,7 @@ jobs: - name: Upload physics package uses: actions/upload-artifact@v4 # should only be set for viewer-private - if: matrix.Linden && steps.build.outputs.physicstpv + if: matrix.configuration == 'Release' && steps.build.outputs.physicstpv with: name: "${{ steps.build.outputs.artifact }}-physics" # emitted by build.sh, zero or one lines @@ -411,6 +398,7 @@ jobs: BUGSPLAT_USER: ${{ secrets.BUGSPLAT_USER }} BUGSPLAT_PASS: ${{ secrets.BUGSPLAT_PASS }} needs: build + if: needs.build.outputs.configuration == 'Release' runs-on: ubuntu-latest steps: - name: Post Mac symbols @@ -424,13 +412,9 @@ jobs: version: ${{ needs.build.outputs.viewer_version }} (${{ needs.build.outputs.viewer_version }}) release: - needs: [setvar, build, sign-and-package-windows, sign-and-package-mac] + needs: [setup, build, sign-and-package-windows, sign-and-package-mac] runs-on: ubuntu-latest - # action-gh-release requires a tag (presumably for automatic generation of - # release notes). Possible TODO: if we arrive here but do not have a - # suitable tag for github.sha, create one? If we do that, of course remove - # this == 'tag' condition. - if: needs.setvar.outputs.release_run && github.ref_type == 'tag' + if: needs.setup.outputs.release_run steps: - uses: actions/download-artifact@v4 with: diff --git a/autobuild.xml b/autobuild.xml index 892c1fcf5f..7ce8372559 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -537,47 +537,19 @@ <map> <key>platforms</key> <map> - <key>darwin64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>52c41a4547d2d9aceb4a9a1e9e1680c71e5ffa79</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-emoji-shortcodes/releases/download/v6.1.0.5413f58/emoji_shortcodes-6.1.0.5413f58-darwin64-5413f58.tar.zst</string> - </map> - <key>name</key> - <string>darwin64</string> - </map> - <key>linux64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>5b957aa7f353b10ae17b7119e5b3668f48a35325</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-emoji-shortcodes/releases/download/v6.1.0.5413f58/emoji_shortcodes-6.1.0.5413f58-linux64-5413f58.tar.zst</string> - </map> - <key>name</key> - <string>linux64</string> - </map> - <key>windows64</key> + <key>common</key> <map> <key>archive</key> <map> <key>hash</key> - <string>3137e06d376767a631bc9626832d558c4d5e5aa9</string> + <string>9c58108270fbad15a321f75501cdfb9c6b78a6f2</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-emoji-shortcodes/releases/download/v6.1.0.5413f58/emoji_shortcodes-6.1.0.5413f58-windows64-5413f58.tar.zst</string> + <string>https://github.com/secondlife/3p-emoji-shortcodes/releases/download/v15.3.2-r1/emoji_shortcodes-15.3.2.10207138275-common-10207138275.tar.zst</string> </map> <key>name</key> - <string>windows64</string> + <string>common</string> </map> </map> <key>license</key> @@ -587,7 +559,7 @@ <key>copyright</key> <string>Copyright 2017-2019 Miles Johnson.</string> <key>version</key> - <string>6.1.0.5413f58</string> + <string>15.3.2.10207138275</string> <key>name</key> <string>emoji_shortcodes</string> <key>canonical_repo</key> @@ -1067,63 +1039,65 @@ <key>name</key> <string>jpegencoderbasic</string> </map> - <key>jpeglib</key> + <key>libjpeg-turbo</key> <map> <key>platforms</key> <map> - <key>darwin64</key> + <key>windows64</key> <map> <key>archive</key> <map> <key>hash</key> - <string>776d114aa1e3455bb13deaacd756deb07b53ecbe</string> + <string>36144272e381952a7c11f1d593c2916c5c7387d0</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-jpeglib/releases/download/v8c.7846234/jpeglib-8c.7846234-darwin64-7846234.tar.zst</string> + <string>https://github.com/secondlife/3p-libjpeg-turbo/releases/download/v3.0.3-r1/libjpeg_turbo-3.0.3-windows64-10204037839.tar.zst</string> </map> <key>name</key> - <string>darwin64</string> + <string>windows64</string> </map> <key>linux64</key> <map> <key>archive</key> <map> <key>hash</key> - <string>b4b2278bd2fcae85619e2145a243cca388d760d7</string> + <string>f853a7d4fe842e7a661dd71a56a51f65b2ec25c7</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-jpeglib/releases/download/v8c.7846234/jpeglib-8c.7846234-linux64-7846234.tar.zst</string> + <string>https://github.com/secondlife/3p-libjpeg-turbo/releases/download/v3.0.3-r1/libjpeg_turbo-3.0.3-linux64-10204037839.tar.zst</string> </map> <key>name</key> <string>linux64</string> </map> - <key>windows64</key> + <key>darwin64</key> <map> <key>archive</key> <map> <key>hash</key> - <string>d50fcac69eeb9404638da07db96ee3e1191ecf93</string> + <string>6fcbc2c3c91b5e9bfbbc57ddf27d2f3698fe7d99</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-jpeglib/releases/download/v8c.7846234/jpeglib-8c.7846234-windows64-7846234.tar.zst</string> + <string>https://github.com/secondlife/3p-libjpeg-turbo/releases/download/v3.0.3-r1/libjpeg_turbo-3.0.3-darwin64-10204037839.tar.zst</string> </map> <key>name</key> - <string>windows64</string> + <string>darwin64</string> </map> </map> <key>license</key> - <string>jpeglib</string> + <string>libjpeg-turbo</string> <key>license_file</key> - <string>LICENSES/jpeglib.txt</string> + <string>LICENSES/libjpeg-turbo.txt</string> <key>copyright</key> - <string>Copyright (C) 1991-2011, Thomas G. Lane, Guido Vollbeding.</string> + <string>Copyright (C)2009-2024 D. R. Commander. All Rights Reserved. Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.</string> <key>version</key> - <string>8c.7846234</string> + <string>3.0.3</string> <key>name</key> - <string>jpeglib</string> + <string>libjpeg-turbo</string> + <key>canonical_repo</key> + <string>https://github.com/secondlife/3p-libjpeg-turbo</string> <key>description</key> <string>JPEG encoding, decoding library</string> </map> @@ -1218,11 +1192,11 @@ <key>archive</key> <map> <key>hash</key> - <string>d5757ab84d934fa358f299ab91e2e297beaa3dac</string> + <string>e71ae7a645603fe967a69aa5beb5b3009185e177</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-libhunspell/releases/download/v1.3.2.650fb94/libhunspell-1.3.2.650fb94-darwin64-650fb94.tar.zst</string> + <string>https://github.com/secondlife/3p-libhunspell/releases/download/v1.7.2-r1/libhunspell-1.7.2.10207243663-darwin64-10207243663.tar.zst</string> </map> <key>name</key> <string>darwin64</string> @@ -1232,11 +1206,11 @@ <key>archive</key> <map> <key>hash</key> - <string>6413d3bd4cd50c2a6b7f949eb4bd6f0c94feb984</string> + <string>275ffb7f60064d8008aed8406f80f34229f651fc</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-libhunspell/releases/download/v1.3.2.650fb94/libhunspell-1.3.2.650fb94-linux64-650fb94.tar.zst</string> + <string>https://github.com/secondlife/3p-libhunspell/releases/download/v1.7.2-r1/libhunspell-1.7.2.10207243663-linux64-10207243663.tar.zst</string> </map> <key>name</key> <string>linux64</string> @@ -1246,11 +1220,11 @@ <key>archive</key> <map> <key>hash</key> - <string>c1be4a79b20435030b2e0e01b582c61b462c8376</string> + <string>89ff24e93eaeca7949ccdb5cc368f938f5b1f307</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-libhunspell/releases/download/v1.3.2.650fb94/libhunspell-1.3.2.650fb94-windows64-650fb94.tar.zst</string> + <string>https://github.com/secondlife/3p-libhunspell/releases/download/v1.7.2-r1/libhunspell-1.7.2.10207243663-windows64-10207243663.tar.zst</string> </map> <key>name</key> <string>windows64</string> @@ -1261,9 +1235,9 @@ <key>license_file</key> <string>LICENSES/hunspell.txt</string> <key>copyright</key> - <string>See hunspell.txt</string> + <string>LGPL 2.1</string> <key>version</key> - <string>1.3.2.650fb94</string> + <string>1.7.2.10207243663</string> <key>name</key> <string>libhunspell</string> <key>description</key> @@ -1798,18 +1772,6 @@ </map> <key>mikktspace</key> <map> - <key>canonical_repo</key> - <string>https://bitbucket.org/lindenlab/3p-mikktspace</string> - <key>copyright</key> - <string>Copyright (C) 2011 by Morten S. Mikkelsen, Copyright (C) 2022 Blender Authors</string> - <key>description</key> - <string>Mikktspace Tangent Generator</string> - <key>license</key> - <string>Apache 2.0</string> - <key>license_file</key> - <string>mikktspace.txt</string> - <key>name</key> - <string>mikktspace</string> <key>platforms</key> <map> <key>darwin64</key> @@ -1855,8 +1817,20 @@ <string>windows64</string> </map> </map> + <key>license</key> + <string>Apache 2.0</string> + <key>license_file</key> + <string>mikktspace.txt</string> + <key>copyright</key> + <string>Copyright (C) 2011 by Morten S. Mikkelsen, Copyright (C) 2022 Blender Authors</string> <key>version</key> <string>1</string> + <key>name</key> + <string>mikktspace</string> + <key>canonical_repo</key> + <string>https://bitbucket.org/lindenlab/3p-mikktspace</string> + <key>description</key> + <string>Mikktspace Tangent Generator</string> </map> <key>minizip-ng</key> <map> @@ -2080,11 +2054,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>ad0dd0f608b868cc44c225ee48e114239fca2807</string> + <string>1e694e5562b8d844bc44d5f7ae4dce243ee70d23</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-ogg_vorbis/releases/download/v1.3.3-1.3.6.e4101b6/ogg_vorbis-1.3.3-1.3.6.e4101b6-darwin64-e4101b6.tar.zst</string> + <string>https://github.com/secondlife/3p-ogg_vorbis/releases/download/v1.3.5-1.3.7/ogg_vorbis-1.3.5-1.3.7.10218872737-darwin64-10218872737.tar.zst</string> </map> <key>name</key> <string>darwin64</string> @@ -2094,11 +2068,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>90052be851c4fcecc35d8424b4f31352de14ab2f</string> + <string>ce0c6adb6d684eb2f4b2ad8838c67186c59e151a</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-ogg_vorbis/releases/download/v1.3.3-1.3.6-881f65e/ogg_vorbis-1.3.3-1.3.6.881f65e-linux64-881f65e.tar.zst</string> + <string>https://github.com/secondlife/3p-ogg_vorbis/releases/download/v1.3.5-1.3.7/ogg_vorbis-1.3.5-1.3.7.10218872737-linux64-10218872737.tar.zst</string> </map> <key>name</key> <string>linux64</string> @@ -2108,11 +2082,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>2e73a0a5659c9a09eba2f94619aa5c23c7cc3937</string> + <string>9434b592c5d748c5deb64ad548fd1484638e3172</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-ogg_vorbis/releases/download/v1.3.3-1.3.6.e4101b6/ogg_vorbis-1.3.3-1.3.6.e4101b6-windows64-e4101b6.tar.zst</string> + <string>https://github.com/secondlife/3p-ogg_vorbis/releases/download/v1.3.5-1.3.7/ogg_vorbis-1.3.5-1.3.7.10218872737-windows64-10218872737.tar.zst</string> </map> <key>name</key> <string>windows64</string> @@ -2125,7 +2099,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>copyright</key> <string>Copyright (c) 2002, Xiph.org Foundation</string> <key>version</key> - <string>1.3.3-1.3.6.881f65e</string> + <string>1.3.5-1.3.7.10218872737</string> <key>name</key> <string>ogg_vorbis</string> <key>description</key> @@ -2343,66 +2317,6 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>description</key> <string>Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) Library</string> </map> - <key>pcre</key> - <map> - <key>platforms</key> - <map> - <key>darwin64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>b372d37596474043a62568e569b0ce155192f484</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-pcre/releases/download/v8.35.979fd86/pcre-8.35.979fd86-darwin64-979fd86.tar.zst</string> - </map> - <key>name</key> - <string>darwin64</string> - </map> - <key>linux64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>3a722c508a9278a49317e3f749f3256768f1c50b</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-pcre/releases/download/v8.35-3c0eb51/pcre-8.35.3c0eb51-linux64-3c0eb51.tar.zst</string> - </map> - <key>name</key> - <string>linux64</string> - </map> - <key>windows64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>166564afb60a7536a038fae80e2fc9a41d6dbccb</string> - <key>hash_algorithm</key> - <string>sha1</string> - <key>url</key> - <string>https://github.com/secondlife/3p-pcre/releases/download/v8.35.979fd86/pcre-8.35.979fd86-windows64-979fd86.tar.zst</string> - </map> - <key>name</key> - <string>windows64</string> - </map> - </map> - <key>license</key> - <string>bsd</string> - <key>license_file</key> - <string>LICENSES/pcre-license.txt</string> - <key>copyright</key> - <string>Copyright (c) 1997-2014 University of Cambridge; Copyright(c) 2009-2014 Zoltan Herczeg; Copyright (c) 2007-2012, Google Inc.</string> - <key>version</key> - <string>8.35.3c0eb51</string> - <key>name</key> - <string>pcre</string> - <key>description</key> - <string>PCRE Perl-compatible regular expression library</string> - </map> <key>slvoice</key> <map> <key>platforms</key> @@ -2657,40 +2571,16 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <map> <key>platforms</key> <map> - <key>darwin64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>6041bbd4001e3951f96ac3456c7906da</string> - <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113314/980656/viewer_fonts-1.579464-darwin64-579464.tar.bz2</string> - </map> - <key>name</key> - <string>darwin64</string> - </map> - <key>windows64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>1745ba6eec0108250446fe01d4aa065c</string> - <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113307/980631/viewer_fonts-1.579464-windows64-579464.tar.bz2</string> - </map> - <key>name</key> - <string>windows64</string> - </map> <key>common</key> <map> <key>archive</key> <map> <key>hash</key> - <string>c25de57e57856a826b2c146ac951ae0b53250666</string> + <string>e88a7c97a6843d43e0093388f211299ec2892790</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-viewer-fonts/releases/download/v1.0.0-r1/viewer_fonts-1.0.0.8512067490-common-8512067490.tar.zst</string> + <string>https://github.com/secondlife/3p-viewer-fonts/releases/download/v1.1.0-r1/viewer_fonts-1.0.0.10204976553-common-10204976553.tar.zst</string> </map> <key>name</key> <string>common</string> @@ -2703,7 +2593,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>copyright</key> <string>Copyright 2016-2022 Brad Erickson CC-BY-4.0/MIT, Copyright 2016-2022 Twitter, Inc. CC-BY-4.0, Copyright 2013 Joe Loughry and Terence Eden MIT</string> <key>version</key> - <string>1.0.0.8512067490</string> + <string>1.0.0.10204976553</string> <key>name</key> <string>viewer-fonts</string> <key>description</key> @@ -2762,6 +2652,8 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <string>LICENSE</string> <key>copyright</key> <string>Copyright (c) 2000-2012, Linden Research, Inc.</string> + <key>version</key> + <string>3.0-f14b5ec</string> <key>name</key> <string>viewer-manager</string> <key>description</key> @@ -2770,11 +2662,17 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <string>https://bitbucket.org/lindenlab/vmp-standalone</string> <key>source_type</key> <string>hg</string> - <key>version</key> - <string>3.0-f14b5ec</string> </map> <key>vlc-bin</key> <map> + <key>copyright</key> + <string>Copyright (C) 1998-2016 VLC authors and VideoLAN</string> + <key>license</key> + <string>GPL2</string> + <key>license_file</key> + <string>LICENSES/vlc.txt</string> + <key>name</key> + <string>vlc-bin</string> <key>platforms</key> <map> <key>darwin64</key> @@ -2782,11 +2680,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>a26b47ab01a7e2c0add4c236886162c1135b3b79</string> + <string>f13c82042ef8311e57dd75a3b2bda02d70f711b5</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-vlc-bin/releases/download/v3.0.16.c219a5d/vlc_bin-3.0.16.c219a5d-darwin64-c219a5d.tar.zst</string> + <string>https://github.com/secondlife/3p-vlc-bin/releases/download/v3.0.21.e60ee26/vlc_bin-3.0.21.10218721728-darwin64-10218721728.tar.zst</string> </map> <key>name</key> <string>darwin64</string> @@ -2796,26 +2694,18 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>d56002da7435bab166c88d59eeaf69fd87cd897d</string> + <string>bd995441c1a229ed1432ddd837d7d1663b8c5548</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-vlc-bin/releases/download/v3.0.16.c219a5d/vlc_bin-3.0.16.c219a5d-windows64-c219a5d.tar.zst</string> + <string>https://github.com/secondlife/3p-vlc-bin/releases/download/v3.0.21.e60ee26/vlc_bin-3.0.21.10218721728-windows64-10218721728.tar.zst</string> </map> <key>name</key> <string>windows64</string> </map> </map> - <key>license</key> - <string>GPL2</string> - <key>license_file</key> - <string>LICENSES/vlc.txt</string> - <key>copyright</key> - <string>Copyright (C) 1998-2016 VLC authors and VideoLAN</string> <key>version</key> - <string>3.0.16.c219a5d</string> - <key>name</key> - <string>vlc-bin</string> + <string>3.0.21.10218721728</string> </map> <key>vulkan_gltf</key> <map> @@ -2860,11 +2750,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>0a0a972036f2b2c9c97dead40c91f7443b8ab339</string> + <string>baabb11f324be350253b1fb58cf262c1aa19fa70</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.61-debug/webrtc-m114.5735.08.61-debug.9571929057-darwin64-9571929057.tar.zst</string> + <string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.67-debug/webrtc-m114.5735.08.67-debug.10190042668-darwin64-10190042668.tar.zst</string> </map> <key>name</key> <string>darwin64</string> @@ -2874,11 +2764,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>8725ad23f33d946bd5a4e5f28e8c8324925c71a7</string> + <string>a13776c8f99f8975665be66ff8b51a80ba46c718</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.61-debug/webrtc-m114.5735.08.61-debug.9571929057-linux64-9571929057.tar.zst</string> + <string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.67-debug/webrtc-m114.5735.08.67-debug.10190042668-linux64-10190042668.tar.zst</string> </map> <key>name</key> <string>linux64</string> @@ -2888,11 +2778,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>archive</key> <map> <key>hash</key> - <string>db560661807db276a3c7d1e7d9531198c9268f68</string> + <string>965ef5d65a14191a52ee9ec6a9a8a1d2ce3f2ffb</string> <key>hash_algorithm</key> <string>sha1</string> <key>url</key> - <string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.61-debug/webrtc-m114.5735.08.61-debug.9571929057-windows64-9571929057.tar.zst</string> + <string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.67-debug/webrtc-m114.5735.08.67-debug.10190042668-windows64-10190042668.tar.zst</string> </map> <key>name</key> <string>windows64</string> @@ -2905,7 +2795,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <key>copyright</key> <string>Copyright (c) 2011, The WebRTC project authors. All rights reserved.</string> <key>version</key> - <string>m114.5735.08.61-debug.9571929057</string> + <string>m114.5735.08.67-debug.10190042668</string> <key>name</key> <string>webrtc</string> <key>vcs_branch</key> @@ -146,12 +146,21 @@ pre_build() && [ -r "$master_message_template_checkout/message_template.msg" ] \ && template_verifier_master_url="-DTEMPLATE_VERIFIER_MASTER_URL=file://$master_message_template_checkout/message_template.msg" - RELEASE_CRASH_REPORTING=ON - HAVOK=ON + RELEASE_CRASH_REPORTING=OFF + HAVOK=OFF SIGNING=() - if [[ "$arch" == "Darwin" && "$variant" == "Release" ]] - then SIGNING=("-DENABLE_SIGNING:BOOL=YES" \ - "-DSIGNING_IDENTITY:STRING=Developer ID Application: Linden Research, Inc.") + if [[ "$variant" != *OS ]] + then + # Proprietary builds + + RELEASE_CRASH_REPORTING=ON + HAVOK=ON + + if [[ "$arch" == "Darwin" ]] + then + SIGNING=("-DENABLE_SIGNING:BOOL=YES" \ + "-DSIGNING_IDENTITY:STRING=Developer ID Application: Linden Research, Inc.") + fi fi if [[ "$arch" == "Linux" ]] diff --git a/doc/contributions.txt b/doc/contributions.txt index 5a4d276a20..54817ca52d 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -1436,6 +1436,30 @@ Sovereign Engineer SL-18534 SL-19690 SL-19336 + secondlife/viewer/pull/1283 + secondlife/viewer/pull/1287 + secondlife/viewer/pull/1906 + secondlife/viewer/pull/1930 + secondlife/viewer/pull/1941 + secondlife/viewer/pull/1946 + secondlife/viewer/pull/1948 + secondlife/viewer/pull/1950 + secondlife/viewer/pull/1951 + secondlife/viewer/pull/2066 + secondlife/viewer/pull/2077 + secondlife/viewer/pull/2078 + secondlife/viewer/pull/2080 + secondlife/viewer/pull/2085 + secondlife/viewer/pull/2098 + secondlife/viewer/pull/2099 + secondlife/viewer/pull/2105 + secondlife/viewer/pull/2115 + secondlife/viewer/pull/2116 + secondlife/viewer/pull/2124 + secondlife/viewer/pull/2125 + secondlife/viewer/pull/2135 + secondlife/viewer/pull/2136 + secondlife/viewer/pull/2149 SpacedOut Frye VWR-34 VWR-45 diff --git a/indra/cmake/Audio.cmake b/indra/cmake/Audio.cmake index 5efaff07c7..6de33af314 100644 --- a/indra/cmake/Audio.cmake +++ b/indra/cmake/Audio.cmake @@ -1,4 +1,5 @@ # -*- cmake -*- +include(Linking) include(Prebuilt) include_guard() @@ -9,7 +10,16 @@ use_prebuilt_binary(ogg_vorbis) target_include_directories( ll::vorbis SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include ) if (WINDOWS) - target_link_libraries(ll::vorbis INTERFACE ogg_static vorbis_static vorbisenc_static vorbisfile_static ) + target_link_libraries(ll::vorbis INTERFACE + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libogg.lib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libogg.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisenc.lib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libvorbisenc.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisfile.lib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libvorbisfile.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbis.lib + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libvorbis.lib + ) else (WINDOWS) target_link_libraries(ll::vorbis INTERFACE vorbisfile vorbis ogg vorbisenc ) endif (WINDOWS) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 28c7377e23..bed365fdda 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -57,7 +57,6 @@ if(WINDOWS) libapr-1.dll libaprutil-1.dll nghttp2.dll - libhunspell.dll ) # OpenSSL @@ -185,7 +184,6 @@ elseif(DARWIN) libaprutil-1.0.dylib libaprutil-1.dylib ${EXPAT_COPY} - libhunspell-1.3.0.dylib libndofdev.dylib libnghttp2.dylib libnghttp2.14.dylib diff --git a/indra/cmake/Hunspell.cmake b/indra/cmake/Hunspell.cmake index bb037c0237..129679febd 100644 --- a/indra/cmake/Hunspell.cmake +++ b/indra/cmake/Hunspell.cmake @@ -1,4 +1,5 @@ # -*- cmake -*- +include(Linking) include(Prebuilt) include_guard() @@ -8,10 +9,16 @@ add_library( ll::hunspell INTERFACE IMPORTED ) use_system_binary(hunspell) use_prebuilt_binary(libhunspell) if (WINDOWS) - target_link_libraries( ll::hunspell INTERFACE libhunspell) + target_compile_definitions( ll::hunspell INTERFACE HUNSPELL_STATIC=1) + target_link_libraries( ll::hunspell INTERFACE + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libhunspell.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libhunspell.lib + ) elseif(DARWIN) - target_link_libraries( ll::hunspell INTERFACE hunspell-1.3) + target_link_libraries( ll::hunspell INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libhunspell-1.7.a + ) elseif(LINUX) - target_link_libraries( ll::hunspell INTERFACE hunspell-1.3) + target_link_libraries( ll::hunspell INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libhunspell-1.7.a + ) endif() target_include_directories( ll::hunspell SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/hunspell) diff --git a/indra/cmake/JPEG.cmake b/indra/cmake/JPEG.cmake index 252d7852d4..ade5a070cc 100644 --- a/indra/cmake/JPEG.cmake +++ b/indra/cmake/JPEG.cmake @@ -7,12 +7,14 @@ include_guard() add_library( ll::libjpeg INTERFACE IMPORTED ) use_system_binary(libjpeg) -use_prebuilt_binary(jpeglib) +use_prebuilt_binary(libjpeg-turbo) if (LINUX) - target_link_libraries( ll::libjpeg INTERFACE jpeg) + target_link_libraries( ll::libjpeg INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libjpeg.a) elseif (DARWIN) - target_link_libraries( ll::libjpeg INTERFACE jpeg) + target_link_libraries( ll::libjpeg INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libjpeg.a) elseif (WINDOWS) - target_link_libraries( ll::libjpeg INTERFACE jpeglib) + target_link_libraries( ll::libjpeg INTERFACE + debug ${ARCH_PREBUILT_DIRS_DEBUG}/jpeg.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/jpeg.lib) endif (LINUX) target_include_directories( ll::libjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 735f5e8052..1e81532551 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -6,7 +6,6 @@ include(Boost) include_guard() -add_library( ll::pcre INTERFACE IMPORTED ) add_library( ll::minizip-ng INTERFACE IMPORTED ) add_library( ll::libxml INTERFACE IMPORTED ) add_library( ll::colladadom INTERFACE IMPORTED ) @@ -22,11 +21,8 @@ use_system_binary( colladadom ) use_prebuilt_binary(colladadom) use_prebuilt_binary(minizip-ng) # needed for colladadom -use_prebuilt_binary(pcre) use_prebuilt_binary(libxml2) -target_link_libraries( ll::pcre INTERFACE pcrecpp pcre ) - if (WINDOWS) target_link_libraries( ll::minizip-ng INTERFACE libminizip ) else() diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 264b9a0be1..ecbcdb3bf5 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -38,7 +38,7 @@ LLStringTable LLCharacter::sVisualParamNames(1024); -std::vector< LLCharacter* > LLCharacter::sInstances; +std::list< LLCharacter* > LLCharacter::sInstances; bool LLCharacter::sAllowInstancesChange = true ; //----------------------------------------------------------------------------- @@ -53,7 +53,6 @@ LLCharacter::LLCharacter() mSkeletonSerialNum( 0 ) { llassert_always(sAllowInstancesChange) ; - sInstances.push_back(this); mMotionController.setCharacter( this ); mPauseRequest = new LLPauseRequestHandle(); @@ -66,28 +65,12 @@ LLCharacter::LLCharacter() //----------------------------------------------------------------------------- LLCharacter::~LLCharacter() { - for (LLVisualParam *param = getFirstVisualParam(); - param; - param = getNextVisualParam()) + for (const auto& it : mVisualParamIndexMap) { - delete param; + delete it.second; } - size_t i ; - size_t size = sInstances.size() ; - for(i = 0 ; i < size ; i++) - { - if(sInstances[i] == this) - { - break ; - } - } - - llassert_always(i < size) ; - llassert_always(sAllowInstancesChange) ; - sInstances[i] = sInstances[size - 1] ; - sInstances.pop_back() ; } diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index b390960a75..6da28f0692 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -255,7 +255,7 @@ public: U32 getSkeletonSerialNum() const { return mSkeletonSerialNum; } void setSkeletonSerialNum( U32 num ) { mSkeletonSerialNum = num; } - static std::vector< LLCharacter* > sInstances; + static std::list< LLCharacter* > sInstances; static bool sAllowInstancesChange ; //debug use virtual void setHoverOffset(const LLVector3& hover_offset, bool send_update=true) { mHoverOffset = hover_offset; } diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 12212efb66..6790f1ad56 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -2227,7 +2227,12 @@ bool LLKeyframeMotion::dumpToFile(const std::string& name) } S32 file_size = getFileSize(); - U8* buffer = new U8[file_size]; + U8* buffer = new(std::nothrow) U8[file_size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer, file: " << name << " " << file_size << LL_ENDL; + } LL_DEBUGS("BVH") << "Dumping " << outfilename << LL_ENDL; LLDataPackerBinaryBuffer dp(buffer, file_size); @@ -2407,13 +2412,10 @@ void LLKeyframeMotion::onLoadComplete(const LLUUID& asset_uuid, { LLUUID* id = (LLUUID*)user_data; - std::vector<LLCharacter* >::iterator char_iter = LLCharacter::sInstances.begin(); - - while(char_iter != LLCharacter::sInstances.end() && - (*char_iter)->getID() != *id) - { - ++char_iter; - } + auto char_iter = std::find_if(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), [&](LLCharacter* c) + { + return c->getID() == *id; + }); delete id; @@ -2438,7 +2440,12 @@ void LLKeyframeMotion::onLoadComplete(const LLUUID& asset_uuid, LLFileSystem file(asset_uuid, type, LLFileSystem::READ); S32 size = file.getSize(); - U8* buffer = new U8[size]; + U8* buffer = new(std::nothrow) U8[size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer of size: " << size << LL_ENDL; + } file.read((U8*)buffer, size); /*Flawfinder: ignore*/ LL_DEBUGS("Animation") << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << LL_ENDL; diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 9eb92ca6a1..e5d25b52f0 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -269,6 +269,7 @@ void LLThread::shutdown() mStatus = STOPPED; return; } + delete mThreadp; mThreadp = NULL; } @@ -299,6 +300,7 @@ void LLThread::start() { mThreadp = new std::thread(std::bind(&LLThread::threadRun, this)); mNativeHandle = mThreadp->native_handle(); + mThreadp->detach(); } catch (std::system_error& ex) { diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index 972f502aa9..19a43839af 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -70,7 +70,6 @@ target_link_libraries(llprimitive llrender llphysicsextensions_impl ll::colladadom - ll::pcre ll::glh_linear ) diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 176c7a5d2c..428370057e 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -726,7 +726,7 @@ void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& c } gGL.end(); - LLRender2D::getInstance()->setLineWidth(1.f); + LLRender2D::setLineWidth(1.f); } void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, bool filled, F32 start_angle, F32 end_angle) diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 0d3efc38d6..096e7584f1 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -122,12 +122,13 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, bool class LLImageProviderInterface; -class LLRender2D : public LLParamSingleton<LLRender2D> +class LLRender2D : public LLSimpleton<LLRender2D> { - LLSINGLETON(LLRender2D, LLImageProviderInterface* image_provider); LOG_CLASS(LLRender2D); - ~LLRender2D(); public: + LLRender2D(LLImageProviderInterface* image_provider); + ~LLRender2D(); + static void pushMatrix(); static void popMatrix(); static void loadIdentity(); diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index d31a91e2af..dc18bf16bf 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -81,10 +81,10 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c } } - LLRender2D::getInstance()->pushMatrix(); + LLRender2D::pushMatrix(); { LLVector3 rect_origin = origin_agent + ((F32)rect.mLeft * x_axis) + ((F32)rect.mBottom * y_axis); - LLRender2D::getInstance()->translate(rect_origin.mV[VX], + LLRender2D::translate(rect_origin.mV[VX], rect_origin.mV[VY], rect_origin.mV[VZ]); gGL.getTexUnit(0)->bind(getImage()); @@ -103,7 +103,7 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c (F32)rect.getWidth() * x_axis, (F32)rect.getHeight() * y_axis); - } LLRender2D::getInstance()->popMatrix(); + } LLRender2D::popMatrix(); } //#include "lluiimage.inl" diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 7b612e445b..30968225a8 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1127,12 +1127,12 @@ void LLButton::setImageSelected(LLPointer<LLUIImage> image) mImageSelected = image; } -void LLButton::setImageColor(const LLColor4& c) +void LLButton::setImageColor(const LLUIColor& c) { mImageColor = c; } -void LLButton::setColor(const LLColor4& color) +void LLButton::setColor(const LLUIColor& color) { setImageColor(color); } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index a54a5b1a43..4ecea6d473 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -172,8 +172,8 @@ public: virtual void onCommit(); - void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; } - void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; } + void setUnselectedLabelColor( const LLUIColor& c ) { mUnselectedLabelColor = c; } + void setSelectedLabelColor( const LLUIColor& c ) { mSelectedLabelColor = c; } void setUseEllipses( bool use_ellipses ) { mUseEllipses = use_ellipses; } void setUseFontColor( bool use_font_color) { mUseFontColor = use_font_color; } @@ -224,14 +224,14 @@ public: const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } void setImageColor(const std::string& color_control); - void setImageColor(const LLColor4& c); - /*virtual*/ void setColor(const LLColor4& c); + void setImageColor(const LLUIColor& c); + /*virtual*/ void setColor(const LLUIColor& c); void setImages(const std::string &image_name, const std::string &selected_name); - void setDisabledImageColor(const LLColor4& c) { mDisabledImageColor = c; } + void setDisabledImageColor(const LLUIColor& c) { mDisabledImageColor = c; } - void setDisabledSelectedLabelColor( const LLColor4& c ) { mDisabledSelectedLabelColor = c; } + void setDisabledSelectedLabelColor( const LLUIColor& c ) { mDisabledSelectedLabelColor = c; } void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); @@ -246,7 +246,7 @@ public: virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text ); void setLabelUnselected(const LLStringExplicit& label); void setLabelSelected(const LLStringExplicit& label); - void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; } + void setDisabledLabelColor( const LLUIColor& c ) { mDisabledLabelColor = c; } void setFont(const LLFontGL *font) { mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); } diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index dea262942b..fc751cfc7f 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -172,11 +172,11 @@ void LLCheckBoxCtrl::setEnabled(bool b) if (b) { - mLabel->setColor( mTextEnabledColor.get() ); + mLabel->setColor( mTextEnabledColor ); } else { - mLabel->setColor( mTextDisabledColor.get() ); + mLabel->setColor( mTextDisabledColor ); } } diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index fc04a8a781..135f128692 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -110,8 +110,8 @@ public: void setBtnFocus() { mButton->setFocus(true); } - void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; } - void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; } + void setEnabledColor( const LLUIColor&color ) { mTextEnabledColor = color; } + void setDisabledColor( const LLUIColor&color ) { mTextDisabledColor = color; } void setLabel( const LLStringExplicit& label ); std::string getLabel() const; diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 4f52f5936d..91e6f281da 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -183,7 +183,8 @@ void LLConsole::draw() static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f); F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f); - static LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground"); + static LLUIColor console_color = LLUIColorTable::instance().getColor("ConsoleBackground"); + LLColor4 color = console_color; color.mV[VALPHA] *= console_opacity; F32 line_height = (F32)mFont->getLineHeight(); diff --git a/indra/llui/llemojihelper.cpp b/indra/llui/llemojihelper.cpp index fbe313924c..b9441a9c91 100644 --- a/indra/llui/llemojihelper.cpp +++ b/indra/llui/llemojihelper.cpp @@ -76,7 +76,9 @@ bool LLEmojiHelper::isCursorInEmojiCode(const LLWString& wtext, S32 cursorPos, S shortCodePos--; } - bool isShortCode = (L':' == wtext[shortCodePos - 1]) && (cursorPos - shortCodePos >= 2); + bool isShortCode = (cursorPos - shortCodePos >= 2) && (L':' == wtext[shortCodePos - 1]); + if(isShortCode && (shortCodePos >= 2) && isdigit(wtext[shortCodePos - 2])) // <TS:3T> Add qualifier to avoid emoji pop-up when typing times. + isShortCode = false; if (pShortCodePos) *pShortCodePos = (isShortCode) ? shortCodePos - 1 : -1; return isShortCode; diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 937dde4def..c635d24f51 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -183,7 +183,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) } } - LLUI::getInstance()->removePopup(view); + if(LLUI::instanceExists()) LLUI::getInstance()->removePopup(view); } void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool keystrokes_only) @@ -481,7 +481,7 @@ void LLFocusMgr::setAppHasFocus(bool focus) // release focus from "top ctrl"s, which generally hides them if (!focus) { - LLUI::getInstance()->clearPopups(); + if(LLUI::instanceExists()) LLUI::getInstance()->clearPopups(); } mAppHasFocus = focus; } diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 63a600b15f..e4f5664908 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -784,7 +784,7 @@ void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeybo const S32 FOCUS_LEFT = 1; // Determine which background color to use for highlighting - LLUIColor bgColor = (isFlashing() ? flashColor : selectColor); + const LLUIColor& bgColor = (isFlashing() ? flashColor : selectColor); //--------------------------------------------------------------------------------// // Draw highlight for selected items @@ -999,7 +999,7 @@ void LLFolderViewItem::draw() // if (!mLabelSuffix.empty()) { - suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor, + suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(), LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x); } diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index aae1d1d572..29d3f0c3d4 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -79,7 +79,7 @@ public: std::string getImageName() const; - void setColor(const LLColor4& color) { mColor = color; } + void setColor(const LLUIColor& color) { mColor = color; } void setImage(LLPointer<LLUIImage> image) { mImagep = image; } const LLPointer<LLUIImage> getImage() { return mImagep; } diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index cc567adb75..7bf43c22c1 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -85,7 +85,7 @@ LLKeywords::~LLKeywords() // Add the token as described void LLKeywords::addToken(LLKeywordToken::ETokenType type, const std::string& key_in, - const LLColor4& color, + const LLUIColor& color, const std::string& tool_tip_in, const std::string& delimiter_in) { @@ -170,7 +170,7 @@ std::string LLKeywords::getAttribute(std::string_view key) return (it != mAttributes.end()) ? it->second : ""; } -LLColor4 LLKeywords::getColorGroup(std::string_view key_in) +LLUIColor LLKeywords::getColorGroup(std::string_view key_in) { std::string color_group = "ScriptText"; if (key_in == "functions") @@ -263,10 +263,10 @@ void LLKeywords::processTokens() void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group) { - LLColor4 color; - LLColor4 color_group; - LLColor4 color_deprecated = getColorGroup("deprecated"); - LLColor4 color_god_mode = getColorGroup("god-mode"); + LLUIColor color; + LLUIColor color_group; + LLUIColor color_deprecated = getColorGroup("deprecated"); + LLUIColor color_god_mode = getColorGroup("god-mode"); LLKeywordToken::ETokenType token_type = LLKeywordToken::TT_UNKNOWN; // If a new token type is added here, it must also be added to the 'addToken' method @@ -296,7 +296,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group) } color_group = getColorGroup(group); - LL_DEBUGS("SyntaxLSL") << "Group: '" << group << "', using color: '" << color_group << "'" << LL_ENDL; + LL_DEBUGS("SyntaxLSL") << "Group: '" << group << "', using color: '" << color_group.get() << "'" << LL_ENDL; if (tokens.isMap()) { @@ -378,7 +378,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group) } else if (tokens.isArray()) // Currently nothing should need this, but it's here for completeness { - LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << color << LL_ENDL; + LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << color.get() << LL_ENDL; for (S32 count = 0; count < tokens.size(); ++count) { addToken(token_type, tokens[count], color, ""); @@ -725,7 +725,7 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen insertSegment( seg_list, text_segment, text_len, style, editor); } -void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, LLTextEditor& editor ) +void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLUIColor& defaultColor, LLTextEditor& editor ) { LLTextSegmentPtr last = seg_list.back(); S32 new_seg_end = new_segment->getEnd(); diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 6df2da7cd3..328561c92a 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -72,7 +72,7 @@ public: TT_TYPE // WORD } ETokenType; - LLKeywordToken( ETokenType type, const LLColor4& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) + LLKeywordToken( ETokenType type, const LLUIColor& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter ) : mType( type ), mToken( token ), @@ -87,7 +87,7 @@ public: bool isHead(const llwchar* s) const; bool isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } - const LLColor4& getColor() const { return mColor; } + const LLUIColor& getColor() const { return mColor; } ETokenType getType() const { return mType; } const LLWString& getToolTip() const { return mToolTip; } const LLWString& getDelimiter() const { return mDelimiter; } @@ -99,7 +99,7 @@ public: private: ETokenType mType; LLWString mToken; - LLColor4 mColor; + LLUIColor mColor; LLWString mToolTip; LLWString mDelimiter; }; @@ -111,7 +111,7 @@ public: ~LLKeywords(); void clearLoaded() { mLoaded = false; } - LLColor4 getColorGroup(std::string_view key_in); + LLUIColor getColorGroup(std::string_view key_in); bool isLoaded() const { return mLoaded; } void findSegments(std::vector<LLTextSegmentPtr> *seg_list, @@ -124,7 +124,7 @@ public: // Add the token as described void addToken(LLKeywordToken::ETokenType type, const std::string& key, - const LLColor4& color, + const LLUIColor& color, const std::string& tool_tip = LLStringUtil::null, const std::string& delimiter = LLStringUtil::null); @@ -153,7 +153,7 @@ public: bool mOwner; - LLColor4 mColor; + LLUIColor mColor; }; typedef std::map<WStringMapIndex, LLKeywordToken*> word_token_map_t; @@ -161,7 +161,7 @@ public: keyword_iterator_t begin() const { return mWordTokenMap.begin(); } keyword_iterator_t end() const { return mWordTokenMap.end(); } - typedef std::map<WStringMapIndex, LLColor4> group_color_map_t; + typedef std::map<WStringMapIndex, LLUIColor> group_color_map_t; typedef group_color_map_t::const_iterator color_iterator_t; group_color_map_t mColorGroupMap; @@ -174,7 +174,7 @@ protected: void insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, - const LLColor4 &defaultColor, + const LLUIColor &defaultColor, class LLTextEditor& editor); void insertSegments(const LLWString& wtext, std::vector<LLTextSegmentPtr>& seg_list, diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 1cb7cac854..cdd22413e7 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -204,7 +204,7 @@ public: void setText(const LLStringExplicit &new_text); const std::string& getText() const override { return mText.getString(); } - LLWString getWText() const { return mText.getWString(); } + const LLWString& getWText() const { return mText.getWString(); } LLWString getConvertedText() const; // trimmed text with paragraphs converted to newlines S32 getLength() const { return mText.length(); } @@ -224,12 +224,12 @@ public: void setRevertOnEsc( bool b ) { mRevertOnEsc = b; } void setKeystrokeOnEsc(bool b) { mKeystrokeOnEsc = b; } - void setCursorColor(const LLColor4& c) { mCursorColor = c; } + void setCursorColor(const LLUIColor& c) { mCursorColor = c; } const LLColor4& getCursorColor() const { return mCursorColor.get(); } - void setFgColor( const LLColor4& c ) { mFgColor = c; } - void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; } - void setTentativeFgColor(const LLColor4& c) { mTentativeFgColor = c; } + void setFgColor( const LLUIColor& c ) { mFgColor = c; } + void setReadOnlyFgColor( const LLUIColor& c ) { mReadOnlyFgColor = c; } + void setTentativeFgColor(const LLUIColor& c) { mTentativeFgColor = c; } const LLColor4& getFgColor() const { return mFgColor.get(); } const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor.get(); } diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 6b9a1b1c13..3235110662 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -440,7 +440,7 @@ void LLMultiSliderCtrl::setEnabled(bool b) if( mLabelBox ) { - mLabelBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() ); + mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor ); } mMultiSlider->setEnabled( b ); @@ -452,7 +452,7 @@ void LLMultiSliderCtrl::setEnabled(bool b) if( mTextBox ) { - mTextBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() ); + mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor ); } } diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index fee05c92fd..dec6cb48b9 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -130,8 +130,8 @@ public: bool canAddSliders() { return mMultiSlider->canAddSliders(); } void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); } - void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } - void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } + void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; } + void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; } boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb ); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index ab3433af98..8e96bdde80 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -490,8 +490,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p) setBackgroundVisible(p.background_visible); setBackgroundOpaque(p.background_opaque); - setBackgroundColor(p.bg_opaque_color().get()); - setTransparentColor(p.bg_alpha_color().get()); + setBackgroundColor(p.bg_opaque_color); + setTransparentColor(p.bg_alpha_color); mBgOpaqueImage = p.bg_opaque_image(); mBgAlphaImage = p.bg_alpha_image(); mBgOpaqueImageOverlay = p.bg_opaque_image_overlay; @@ -693,7 +693,7 @@ void LLPanel::childSetCommitCallback(std::string_view id, boost::function<void ( } } -void LLPanel::childSetColor(std::string_view id, const LLColor4& color) +void LLPanel::childSetColor(std::string_view id, const LLUIColor& color) { LLUICtrl* child = findChild<LLUICtrl>(id); if (child) diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index f6aa91fb30..f085c123c1 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -134,16 +134,16 @@ public: bool hasBorder() const { return mBorder != NULL; } void setBorderVisible( bool b ); - void setBackgroundColor( const LLColor4& color ) { mBgOpaqueColor = color; } + void setBackgroundColor( const LLUIColor& color ) { mBgOpaqueColor = color; } const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; } - void setTransparentColor(const LLColor4& color) { mBgAlphaColor = color; } + void setTransparentColor(const LLUIColor& color) { mBgAlphaColor = color; } const LLColor4& getTransparentColor() const { return mBgAlphaColor; } void setBackgroundImage(LLUIImage* image) { mBgOpaqueImage = image; } void setTransparentImage(LLUIImage* image) { mBgAlphaImage = image; } LLPointer<LLUIImage> getBackgroundImage() const { return mBgOpaqueImage; } LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; } - LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; } - LLColor4 getTransparentImageOverlay() { return mBgAlphaImageOverlay; } + const LLColor4& getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; } + const LLColor4& getTransparentImageOverlay() { return mBgAlphaImageOverlay; } void setBackgroundVisible( bool b ) { mBgVisible = b; } bool isBackgroundVisible() const { return mBgVisible; } void setBackgroundOpaque(bool b) { mBgOpaque = b; } @@ -192,7 +192,7 @@ public: // which takes a generic slot. Or use mCommitCallbackRegistrar.add() with // a named callback and reference it in XML. void childSetCommitCallback(std::string_view id, boost::function<void (LLUICtrl*,void*)> cb, void* data); - void childSetColor(std::string_view id, const LLColor4& color); + void childSetColor(std::string_view id, const LLUIColor& color); LLCtrlSelectionInterface* childGetSelectionInterface(std::string_view id) const; LLCtrlListInterface* childGetListInterface(std::string_view id) const; diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 88ef4eb0c1..7ef2e54429 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -465,7 +465,7 @@ LLScrollListCheck::LLScrollListCheck(const LLScrollListCell::Params& p) setWidth(rect.getWidth()); //check_box->getWidth(); } - mCheckBox->setColor(p.color); + mCheckBox->setColor(p.color()); } diff --git a/indra/llui/llsearchablecontrol.h b/indra/llui/llsearchablecontrol.h index bccb4858e1..119852b763 100644 --- a/indra/llui/llsearchablecontrol.h +++ b/indra/llui/llsearchablecontrol.h @@ -43,7 +43,7 @@ namespace ll virtual ~SearchableControl() { } - LLColor4 getHighlightColor( ) const + const LLColor4& getHighlightColor( ) const { static LLUIColor highlight_color = LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red); return highlight_color.get(); diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 0c3ab6bda0..66e97f093f 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -393,7 +393,7 @@ void LLSliderCtrl::setEnabled(bool b) if( mLabelBox ) { - mLabelBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() ); + mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor ); } mSlider->setEnabled( b ); @@ -405,7 +405,7 @@ void LLSliderCtrl::setEnabled(bool b) if( mTextBox ) { - mTextBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() ); + mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor ); } } diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index a55e3bf6e9..311377a61f 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -107,8 +107,8 @@ public: F32 getMaxValue() const { return mSlider->getMaxValue(); } void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); } - void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } - void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } + void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; } + void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; } boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb ); diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 9d8eadfd3f..16ffd352cf 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -30,12 +30,7 @@ #include "llsdserialize.h" #include "llspellcheck.h" -#if LL_WINDOWS - #include <hunspell/hunspelldll.h> - #pragma comment(lib, "libhunspell.lib") -#else - #include <hunspell/hunspell.hxx> -#endif +#include <hunspell/hunspell.hxx> static const std::string DICT_DIR = "dictionaries"; static const std::string DICT_FILE_CUSTOM = "user_custom.dic"; @@ -64,11 +59,11 @@ void LLSpellChecker::initSingleton() bool LLSpellChecker::checkSpelling(const std::string& word) const { - if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word.c_str())) ) + if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word)) ) { return true; } - if (mIgnoreList.size() > 0) + if (!mIgnoreList.empty()) { std::string word_lower(word); LLStringUtil::toLower(word_lower); @@ -85,15 +80,8 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str return 0; } - char** suggestion_list; int suggestion_cnt = 0; - if ( (suggestion_cnt = mHunspell->suggest(&suggestion_list, word.c_str())) != 0 ) - { - for (int suggestion_index = 0; suggestion_index < suggestion_cnt; suggestion_index++) - { - suggestions.push_back(suggestion_list[suggestion_index]); - } - mHunspell->free_list(&suggestion_list, suggestion_cnt); - } + suggestions = mHunspell->suggest(word); + return static_cast<S32>(suggestions.size()); } @@ -194,7 +182,7 @@ void LLSpellChecker::addToCustomDictionary(const std::string& word) { if (mHunspell) { - mHunspell->add(word.c_str()); + mHunspell->add(word); } addToDictFile(getDictionaryUserPath() + DICT_FILE_CUSTOM, word); sSettingsChangeSignal(); @@ -422,7 +410,7 @@ bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language) const LLSD dict_info = getDictionaryData(dict_language); return (dict_info["user_installed"].asBoolean()) && - ( (!getUseSpellCheck()) || (!LLSpellChecker::instance().isActiveDictionary(dict_language)) ); + ( (!getUseSpellCheck()) || (!isActiveDictionary(dict_language)) ); } void LLSpellChecker::removeDictionary(const std::string& dict_language) diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 7d41d80334..8cd3e6419a 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -310,7 +310,7 @@ void LLSpinCtrl::updateLabelColor() { if( mLabelBox ) { - mLabelBox->setColor( getEnabled() ? mTextEnabledColor.get() : mTextDisabledColor.get() ); + mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor ); } } diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 75f1830d80..58b38dc630 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -77,8 +77,8 @@ public: virtual void setPrecision(S32 precision); void setLabel(const LLStringExplicit& label); - void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); } - void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();} + void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; updateLabelColor(); } + void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; updateLabelColor();} void setAllowEdit(bool allow_edit); virtual void onTabInto(); diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index 28b4d387f1..d97051247e 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -100,8 +100,8 @@ void LLStatGraph::draw() it--; } - static LLColor4 default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); - gGL.color4fv(default_color.mV); + static LLUIColor default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); + gGL.color4fv(default_color.get().mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true); gGL.color4fv(LLColor4::black.mV); diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index abf6e1284b..df4b0ef6a0 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -33,11 +33,12 @@ #include "llui.h" LLStyle::Params::Params() -: visible("visible", true), + : visible("visible", true), drop_shadow("drop_shadow", LLFontGL::NO_SHADOW), color("color", LLColor4::black), readonly_color("readonly_color", LLColor4::black), selected_color("selected_color", LLColor4::black), + alpha("alpha", 1.f), font("font", LLFontGL::getFontMonospace()), image("image"), link_href("href"), @@ -54,7 +55,8 @@ LLStyle::LLStyle(const LLStyle::Params& p) mLink(p.link_href), mIsLink(p.is_link.isProvided() ? p.is_link : !p.link_href().empty()), mDropShadow(p.drop_shadow), - mImagep(p.image()) + mImagep(p.image()), + mAlpha(p.alpha) {} void LLStyle::setFont(const LLFontGL* font) diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index 7dbccfff87..e506895de5 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -44,6 +44,7 @@ public: Optional<LLUIColor> color, readonly_color, selected_color; + Optional<F32> alpha; Optional<const LLFontGL*> font; Optional<LLUIImage*> image; Optional<std::string> link_href; @@ -61,6 +62,9 @@ public: const LLUIColor& getSelectedColor() const { return mSelectedColor; } void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; } + F32 getAlpha() const { return mAlpha; } + void setAlpha(F32 alpha) { mAlpha = alpha; } + bool isVisible() const; void setVisible(bool is_visible); @@ -89,7 +93,8 @@ public: && mFont == rhs.mFont && mLink == rhs.mLink && mImagep == rhs.mImagep - && mDropShadow == rhs.mDropShadow; + && mDropShadow == rhs.mDropShadow + && mAlpha == rhs.mAlpha; } bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); } @@ -98,18 +103,19 @@ public: LLFontGL::ShadowType mDropShadow; protected: - ~LLStyle() { } + ~LLStyle() = default; private: - bool mVisible; + std::string mFontName; + std::string mLink; LLUIColor mColor; LLUIColor mReadOnlyColor; LLUIColor mSelectedColor; - std::string mFontName; const LLFontGL* mFont; - std::string mLink; - bool mIsLink; LLPointer<LLUIImage> mImagep; + F32 mAlpha; + bool mVisible; + bool mIsLink; }; typedef LLPointer<LLStyle> LLStyleSP; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 8c3b317838..0aebf7543c 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -584,9 +584,8 @@ void LLTextBase::drawCursor() if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection() && text[mCursorPos] != '\n') { - LLColor4 text_color; const LLFontGL* fontp; - text_color = segmentp->getColor(); + const LLColor4& text_color = segmentp->getColor(); fontp = segmentp->getStyle()->getFont(); fontp->render(text, mCursorPos, cursor_rect, LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha), @@ -1368,7 +1367,7 @@ void LLTextBase::draw() { bg_rect.intersectWith(text_rect); } - LLColor4 bg_color = mReadOnly + const LLColor4& bg_color = mReadOnly ? mReadOnlyBgColor.get() : hasFocus() ? mFocusBgColor.get() @@ -1379,7 +1378,7 @@ void LLTextBase::draw() // Draw highlighted if needed if( ll::ui::SearchableControl::getHighlighted() ) { - LLColor4 bg_color = ll::ui::SearchableControl::getHighlightColor(); + const LLColor4& bg_color = ll::ui::SearchableControl::getHighlightColor(); LLRect bg_rect = mVisibleTextRect; if( mScroller ) bg_rect.intersectWith( text_rect ); @@ -1412,14 +1411,14 @@ void LLTextBase::draw() //virtual -void LLTextBase::setColor( const LLColor4& c ) +void LLTextBase::setColor( const LLUIColor& c ) { mFgColor = c; mStyleDirty = true; } //virtual -void LLTextBase::setReadOnlyColor(const LLColor4 &c) +void LLTextBase::setReadOnlyColor(const LLUIColor &c) { mReadOnlyFgColor = c; mStyleDirty = true; @@ -2203,8 +2202,8 @@ static LLUIImagePtr image_from_icon_name(const std::string& icon_name) void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; - LLStyle::Params style_params(input_params); - style_params.fillFrom(getStyleParams()); + LLStyle::Params style_params(getStyleParams()); + style_params.overwriteFrom(input_params); S32 part = (S32)LLTextParser::WHOLE; if (mParseHTML && !style_params.is_link) // Don't search for URLs inside a link segment (STORM-358). @@ -2418,16 +2417,14 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig { LLStyle::Params highlight_params(style_params); - LLSD pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part); + auto pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color, (LLTextParser::EHighlightPosition)highlight_part); for (S32 i = 0; i < pieces.size(); i++) { - LLSD color_llsd = pieces[i]["color"]; - LLColor4 lcolor; - lcolor.setValue(color_llsd); - highlight_params.color = lcolor; + const auto& piece_pair = pieces[i]; + highlight_params.color = piece_pair.second; LLWString wide_text; - wide_text = utf8str_to_wstring(pieces[i]["text"].asString()); + wide_text = utf8str_to_wstring(piece_pair.first); S32 cur_length = getLength(); LLStyleConstSP sp(new LLStyle(highlight_params)); @@ -3247,8 +3244,8 @@ F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_e bool LLTextSegment::canEdit() const { return false; } void LLTextSegment::unlinkFromDocument(LLTextBase*) {} void LLTextSegment::linkToDocument(LLTextBase*) {} -const LLColor4& LLTextSegment::getColor() const { return LLColor4::white; } -//void LLTextSegment::setColor(const LLColor4 &color) {} +const LLUIColor& LLTextSegment::getColor() const { static const LLUIColor white = LLUIColorTable::instance().getColor("White", LLColor4::white); return white; } +//void LLTextSegment::setColor(const LLUIColor &color) {} LLStyleConstSP LLTextSegment::getStyle() const {static LLStyleConstSP sp(new LLStyle()); return sp; } void LLTextSegment::setStyle(LLStyleConstSP style) {} void LLTextSegment::setToken( LLKeywordToken* token ) {} @@ -3294,7 +3291,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e } } -LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) +LLNormalTextSegment::LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLTextSegment(start, end), mToken(NULL), mEditor(editor) @@ -3334,7 +3331,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele const LLFontGL* font = mStyle->getFont(); - LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % alpha; + LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha()); if( selection_start > seg_start ) { @@ -3604,7 +3601,7 @@ LLLabelTextSegment::LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end { } -LLLabelTextSegment::LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) +LLLabelTextSegment::LLLabelTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } @@ -3628,7 +3625,7 @@ LLEmojiTextSegment::LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, { } -LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) +LLEmojiTextSegment::LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLNormalTextSegment(color, start, end, editor, is_visible) { } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 4120d9ea32..00cf66b134 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -84,8 +84,8 @@ public: virtual void unlinkFromDocument(class LLTextBase* editor); virtual void linkToDocument(class LLTextBase* editor); - virtual const LLColor4& getColor() const; - //virtual void setColor(const LLColor4 &color); + virtual const LLUIColor& getColor() const; + //virtual void setColor(const LLUIColor &color); virtual LLStyleConstSP getStyle() const; virtual void setStyle(LLStyleConstSP style); virtual void setToken( LLKeywordToken* token ); @@ -125,7 +125,7 @@ class LLNormalTextSegment : public LLTextSegment { public: LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); + LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); virtual ~LLNormalTextSegment(); /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; @@ -133,7 +133,7 @@ public: /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); /*virtual*/ bool canEdit() const { return true; } - /*virtual*/ const LLColor4& getColor() const { return mStyle->getColor(); } + /*virtual*/ const LLUIColor& getColor() const { return mStyle->getColor(); } /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } /*virtual*/ void setStyle(LLStyleConstSP style) { mStyle = style; } /*virtual*/ void setToken( LLKeywordToken* token ) { mToken = token; } @@ -170,7 +170,7 @@ class LLLabelTextSegment : public LLNormalTextSegment { public: LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ); - LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); + LLLabelTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); protected: @@ -184,7 +184,7 @@ class LLEmojiTextSegment : public LLNormalTextSegment { public: LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor); - LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); + LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true); bool canEdit() const override { return false; } bool handleToolTip(S32 x, S32 y, MASK mask) override; @@ -372,8 +372,8 @@ public: // LLUICtrl interface /*virtual*/ bool acceptsTextInput() const override { return !mReadOnly; } - /*virtual*/ void setColor(const LLColor4& c) override; - virtual void setReadOnlyColor(const LLColor4 &c); + /*virtual*/ void setColor(const LLUIColor& c) override; + virtual void setReadOnlyColor(const LLUIColor& c); /*virtual*/ void onVisibilityChange(bool new_visibility) override; /*virtual*/ void setValue(const LLSD& value) override; diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 097b168106..d4ef77664e 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -36,6 +36,7 @@ #include "llmath.h" #include "v4color.h" #include "lldir.h" +#include "lluicolor.h" // // Member Functions @@ -80,14 +81,14 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight) return static_cast<S32>(found); } -LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index) +LLTextParser::parser_out_vec_t LLTextParser::parsePartialLineHighlights(const std::string &text, const LLUIColor& color, EHighlightPosition part, S32 index) { loadKeywords(); //evil recursive string atomizer. - LLSD ret_llsd, start_llsd, middle_llsd, end_llsd; + parser_out_vec_t ret_vec, start_vec, middle_vec, end_vec; - for (S32 i=index;i<mHighlights.size();i++) + for (S32 i=index, size = (S32)mHighlights.size();i< size;i++) { S32 condition = mHighlights[i]["condition"]; if ((S32)mHighlights[i]["highlight"]==PART && condition!=MATCHES) @@ -104,72 +105,69 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC EHighlightPosition newpart; if (start==0) { - start_llsd[0]["text"] =text.substr(0,end); - start_llsd[0]["color"]=mHighlights[i]["color"]; + if (start_vec.empty()) + { + start_vec.push_back(std::make_pair(text.substr(0, end), LLColor4(mHighlights[i]["color"]))); + } + else + { + start_vec[0] = std::make_pair(text.substr(0, end), LLColor4(mHighlights[i]["color"])); + } if (end < len) { if (part==END || part==WHOLE) newpart=END; else newpart=MIDDLE; - end_llsd=parsePartialLineHighlights(text.substr( end ),color,newpart,i); + end_vec = parsePartialLineHighlights(text.substr( end ),color,newpart,i); } } else { if (part==START || part==WHOLE) newpart=START; else newpart=MIDDLE; - start_llsd=parsePartialLineHighlights(text.substr(0,start),color,newpart,i+1); + start_vec = parsePartialLineHighlights(text.substr(0,start),color,newpart,i+1); if (end < len) { - middle_llsd[0]["text"] =text.substr(start,end); - middle_llsd[0]["color"]=mHighlights[i]["color"]; + if (middle_vec.empty()) + { + middle_vec.push_back(std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"]))); + } + else + { + middle_vec[0] = std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"])); + } if (part==END || part==WHOLE) newpart=END; else newpart=MIDDLE; - end_llsd=parsePartialLineHighlights(text.substr( (start+end) ),color,newpart,i); + end_vec = parsePartialLineHighlights(text.substr( (start+end) ),color,newpart,i); } else { - end_llsd[0]["text"] =text.substr(start,end); - end_llsd[0]["color"]=mHighlights[i]["color"]; + if (end_vec.empty()) + { + end_vec.push_back(std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"]))); + } + else + { + end_vec[0] = std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"])); + } } } - S32 retcount=0; - - //FIXME These loops should be wrapped into a subroutine. - for (LLSD::array_iterator iter = start_llsd.beginArray(); - iter != start_llsd.endArray();++iter) - { - LLSD highlight = *iter; - ret_llsd[retcount++]=highlight; - } - - for (LLSD::array_iterator iter = middle_llsd.beginArray(); - iter != middle_llsd.endArray();++iter) - { - LLSD highlight = *iter; - ret_llsd[retcount++]=highlight; - } - - for (LLSD::array_iterator iter = end_llsd.beginArray(); - iter != end_llsd.endArray();++iter) - { - LLSD highlight = *iter; - ret_llsd[retcount++]=highlight; - } + ret_vec.reserve(start_vec.size() + middle_vec.size() + end_vec.size()); + ret_vec.insert(ret_vec.end(), start_vec.begin(), start_vec.end()); + ret_vec.insert(ret_vec.end(), middle_vec.begin(), middle_vec.end()); + ret_vec.insert(ret_vec.end(), end_vec.begin(), end_vec.end()); - return ret_llsd; + return ret_vec; } } } } //No patterns found. Just send back what was passed in. - ret_llsd[0]["text"] =text; - LLSD color_sd = color.getValue(); - ret_llsd[0]["color"]=color_sd; - return ret_llsd; + ret_vec.push_back(std::make_pair(text, color)); + return ret_vec; } bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *color) diff --git a/indra/llui/lltextparser.h b/indra/llui/lltextparser.h index 20fcc07e4c..c5756f9b4c 100644 --- a/indra/llui/lltextparser.h +++ b/indra/llui/lltextparser.h @@ -30,6 +30,7 @@ #include "llsd.h" #include "llsingleton.h" +#include "lluicolor.h" class LLUUID; class LLVector3d; @@ -45,7 +46,9 @@ public: typedef enum e_highlight_position { WHOLE, START, MIDDLE, END } EHighlightPosition; typedef enum e_dialog_action { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE } EDialogAction; - LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0); + using parser_out_vec_t = std::vector<std::pair<std::string, LLUIColor>>; + + parser_out_vec_t parsePartialLineHighlights(const std::string &text,const LLUIColor &color, EHighlightPosition part=WHOLE, S32 index=0); bool parseFullLineHighlights(const std::string &text, LLColor4 *color); private: diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index aa48ae048f..5955a28fa3 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -1073,7 +1073,7 @@ bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, int orig_rank = getRankFromPosition(dragged_command); mDragRank = getRankFromPosition(x, y); // Don't DaD if we're dragging a command on itself - mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank - 1) == orig_rank))); + mDragAndDropTarget = (orig_rank == RANK_NONE) || ((mDragRank != orig_rank) && ((mDragRank - 1) != orig_rank)); //LL_INFOS() << "Merov debug : DaD, rank = " << mDragRank << ", dragged uui = " << inv_item->getUUID() << LL_ENDL; /* Do the following if you want to animate the button itself LLCommandId dragged_command(inv_item->getUUID()); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index e3ddd66b58..8d46422c09 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -156,7 +156,7 @@ mWindow(NULL), // set later in startup mRootView(NULL), mHelpImpl(NULL) { - LLRender2D::initParamSingleton(image_provider); + LLRender2D::createInstance(image_provider); if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) || (get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) || @@ -196,6 +196,11 @@ mHelpImpl(NULL) LLCommandManager::load(); } +LLUI::~LLUI() +{ + LLRender2D::deleteSingleton(); +} + void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) { mAddPopupFunc = add_popup; diff --git a/indra/llui/llui.h b/indra/llui/llui.h index f33b43f599..375cd539b7 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -112,18 +112,18 @@ class LLImageProviderInterface; typedef void (*LLUIAudioCallback)(const LLUUID& uuid); -class LLUI : public LLParamSingleton<LLUI> +class LLUI : public LLSimpleton<LLUI> { + LOG_CLASS(LLUI); public: typedef std::map<std::string, LLControlGroup*, std::less<> > settings_map_t; -private: - LLSINGLETON(LLUI , const settings_map_t &settings, + LLUI(const settings_map_t &settings, LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback, LLUIAudioCallback deferred_audio_callback); - LOG_CLASS(LLUI); -public: + ~LLUI(); + // // Classes // diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 3279926786..a792cb8103 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -198,7 +198,61 @@ LLUIColor LLUIColorTable::getColor(std::string_view name, const LLColor4& defaul // update user color, loaded colors are parsed on initialization void LLUIColorTable::setColor(std::string_view name, const LLColor4& color) { - setColor(name, color, mUserSetColors); + auto it = mUserSetColors.lower_bound(name); + if(it != mUserSetColors.end() && !(mUserSetColors.key_comp()(name, it->first))) + { + it->second = color; + } + else + { + string_color_map_t::iterator base_iter = mLoadedColors.find(name); + if (base_iter != mLoadedColors.end()) + { + LLColor4 original_color = base_iter->second.get(); + auto color_handle = mLoadedColors.extract(base_iter); + auto new_color_pair = mUserSetColors.insert(std::move(color_handle)); + new_color_pair.position->second = color; + mLoadedColors.emplace(name, LLUIColor(original_color)); + } + else + { + mUserSetColors.insert(it, std::make_pair(name, color)); + } + } +} + +bool LLUIColorTable::isDefault(std::string_view name) const +{ + string_color_map_t::const_iterator base_iter = mLoadedColors.find(name); + string_color_map_t::const_iterator user_iter = mUserSetColors.find(name); + if (base_iter != mLoadedColors.end()) + { + if(user_iter != mUserSetColors.end()) + return user_iter->second == base_iter->second; + + return true; + } + else if (user_iter != mUserSetColors.end()) // user only color ??? + { + return true; + } + + return false; +} + +void LLUIColorTable::resetToDefault(std::string_view name) +{ + string_color_map_t::iterator iter = mUserSetColors.find(name); + + if (iter != mUserSetColors.end()) + { + auto default_iter = mLoadedColors.find(name); + + if (default_iter != mLoadedColors.end()) + { + iter->second = default_iter->second.get(); + } + } } bool LLUIColorTable::loadFromSettings() @@ -223,18 +277,16 @@ void LLUIColorTable::saveUserSettings() const { Params params; - for(string_color_map_t::const_iterator it = mUserSetColors.begin(); - it != mUserSetColors.end(); - ++it) + for (const auto& color_pair : mUserSetColors) { // Compare user color value with the default value, skip if equal - string_color_map_t::const_iterator itd = mLoadedColors.find(it->first); - if(itd != mLoadedColors.end() && itd->second == it->second) + string_color_map_t::const_iterator itd = mLoadedColors.find(color_pair.first); + if(itd != mLoadedColors.end() && itd->second == color_pair.second) continue; ColorEntryParams color_entry; - color_entry.name = it->first; - color_entry.color.value = it->second; + color_entry.name = color_pair.first; + color_entry.color.value = color_pair.second; params.color_entries.add(color_entry); } diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index ca1ca9eaa7..0c6286e5eb 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -83,12 +83,19 @@ public: // returns true if color_name exists in the table bool colorExists(std::string_view color_name) const; + bool isDefault(std::string_view color_name) const; + + void resetToDefault(std::string_view color_name); + // loads colors from settings files bool loadFromSettings(); // saves colors specified by the user to the users skin directory void saveUserSettings() const; + const auto& getLoadedColors() { return mLoadedColors; } + const auto& getUserColors() { return mUserSetColors; } + private: bool loadFromFilename(const std::string& filename, string_color_map_t& table); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index cb86a79407..cbabb5a933 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -1023,7 +1023,7 @@ bool LLUICtrl::getTentative() const } // virtual -void LLUICtrl::setColor(const LLColor4& color) +void LLUICtrl::setColor(const LLUIColor& color) { } F32 LLUICtrl::getCurrentTransparency() diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index fb8fc0c5ea..8cd9950917 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -216,7 +216,7 @@ public: // selected radio button, etc.). Defaults to no-op. virtual void clear(); - virtual void setColor(const LLColor4& color); + virtual void setColor(const LLUIColor& color); // Ansariel: Changed to virtual. We might want to change the transparency ourself! virtual F32 getCurrentTransparency(); diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index c1777c972c..d53fd6eb91 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -73,14 +73,14 @@ LLViewBorder::LLViewBorder(const LLViewBorder::Params& p) mStyle(p.render_style) {} -void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light ) +void LLViewBorder::setColors( const LLUIColor& shadow_dark, const LLUIColor& highlight_light ) { mShadowDark = shadow_dark; mHighlightLight = highlight_light; } -void LLViewBorder::setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark, - const LLColor4& highlight_light, const LLColor4& highlight_dark ) +void LLViewBorder::setColorsExtended( const LLUIColor& shadow_light, const LLUIColor& shadow_dark, + const LLUIColor& highlight_light, const LLUIColor& highlight_dark ) { mShadowDark = shadow_dark; mShadowLight = shadow_light; diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h index be499bb534..1f118a0d20 100644 --- a/indra/llui/llviewborder.h +++ b/indra/llui/llviewborder.h @@ -77,9 +77,9 @@ public: S32 getBorderWidth() const { return mBorderWidth; } void setBevel(EBevel bevel) { mBevel = bevel; } EBevel getBevel() const { return mBevel; } - void setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light ); - void setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark, - const LLColor4& highlight_light, const LLColor4& highlight_dark ); + void setColors( const LLUIColor& shadow_dark, const LLUIColor& highlight_light ); + void setColorsExtended( const LLUIColor& shadow_light, const LLUIColor& shadow_dark, + const LLUIColor& highlight_light, const LLUIColor& highlight_dark ); void setTexture( const class LLUUID &image_id ); LLColor4 getHighlightLight() {return mHighlightLight.get();} diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 6dc632aba4..2c890acbdb 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -154,7 +154,8 @@ void LLCustomProcessor::Process(webrtc::AudioBuffer *audio_in) // LLWebRTCImpl implementation // -LLWebRTCImpl::LLWebRTCImpl() : +LLWebRTCImpl::LLWebRTCImpl(LLWebRTCLogCallback* logCallback) : + mLogSink(new LLWebRTCLogSink(logCallback)), mPeerCustomProcessor(nullptr), mMute(true), mTuningMode(false), @@ -173,6 +174,7 @@ void LLWebRTCImpl::init() // Normal logging is rather spammy, so turn it off. rtc::LogMessage::LogToDebug(rtc::LS_NONE); rtc::LogMessage::SetLogToStderr(true); + rtc::LogMessage::AddLogToStream(mLogSink, rtc::LS_VERBOSE); mTaskQueueFactory = webrtc::CreateDefaultTaskQueueFactory(); @@ -312,6 +314,7 @@ void LLWebRTCImpl::terminate() mPeerDeviceModule = nullptr; mTaskQueueFactory = nullptr; }); + rtc::LogMessage::RemoveLogToStream(mLogSink); } // @@ -1327,9 +1330,9 @@ void freePeerConnection(LLWebRTCPeerConnectionInterface* peer_connection) } -void init() +void init(LLWebRTCLogCallback* logCallback) { - gWebRTCImpl = new LLWebRTCImpl(); + gWebRTCImpl = new LLWebRTCImpl(logCallback); gWebRTCImpl->init(); } diff --git a/indra/llwebrtc/llwebrtc.h b/indra/llwebrtc/llwebrtc.h index 62b40636d2..c6fdb909dd 100644 --- a/indra/llwebrtc/llwebrtc.h +++ b/indra/llwebrtc/llwebrtc.h @@ -56,6 +56,20 @@ namespace llwebrtc { +class LLWebRTCLogCallback +{ +public: + typedef enum { + LOG_LEVEL_VERBOSE = 0, + LOG_LEVEL_INFO, + LOG_LEVEL_WARNING, + LOG_LEVEL_ERROR + } LogLevel; + + virtual void LogMessage(LogLevel level, const std::string& message) = 0; +}; + + // LLWebRTCVoiceDevice is a simple representation of the // components of a device, used to communicate this // information to the viewer. @@ -230,7 +244,7 @@ class LLWebRTCSignalingObserver // allows for management of this peer connection. class LLWebRTCPeerConnectionInterface { -public: + public: struct InitOptions { @@ -262,7 +276,7 @@ public: // exports. // This library must be initialized before use. -LLSYMEXPORT void init(); +LLSYMEXPORT void init(LLWebRTCLogCallback* logSink); // And should be terminated as part of shutdown. LLSYMEXPORT void terminate(); diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h index c1acd77275..9504e6573b 100644 --- a/indra/llwebrtc/llwebrtc_impl.h +++ b/indra/llwebrtc/llwebrtc_impl.h @@ -69,6 +69,54 @@ namespace llwebrtc class LLWebRTCPeerConnectionImpl; +class LLWebRTCLogSink : public rtc::LogSink { +public: + LLWebRTCLogSink(LLWebRTCLogCallback* callback) : + mCallback(callback) + { + } + + // Destructor: close the log file + ~LLWebRTCLogSink() override + { + } + + void OnLogMessage(const std::string& msg, + rtc::LoggingSeverity severity) override + { + if (mCallback) + { + switch(severity) + { + case rtc::LS_VERBOSE: + mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg); + break; + case rtc::LS_INFO: + mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg); + break; + case rtc::LS_WARNING: + mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg); + break; + case rtc::LS_ERROR: + mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, msg); + break; + default: + break; + } + } + } + + void OnLogMessage(const std::string& message) override + { + if (mCallback) + { + mCallback->LogMessage(LLWebRTCLogCallback::LOG_LEVEL_VERBOSE, message); + } + } + +private: + LLWebRTCLogCallback* mCallback; +}; // Implements a class allowing capture of audio data // to determine audio level of the microphone. @@ -139,8 +187,11 @@ class LLCustomProcessor : public webrtc::CustomProcessing class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceSink { public: - LLWebRTCImpl(); - ~LLWebRTCImpl() {} + LLWebRTCImpl(LLWebRTCLogCallback* logCallback); + ~LLWebRTCImpl() + { + delete mLogSink; + } void init(); void terminate(); @@ -228,6 +279,8 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceS void setRecording(bool recording); protected: + LLWebRTCLogSink* mLogSink; + // The native webrtc threads std::unique_ptr<rtc::Thread> mNetworkThread; std::unique_ptr<rtc::Thread> mWorkerThread; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e67286af3d..8894bcd3d5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -286,6 +286,7 @@ set(viewer_SOURCE_FILES llfloaterscriptlimits.cpp llfloatersearch.cpp llfloatersellland.cpp + llfloatersettingscolor.cpp llfloatersettingsdebug.cpp llfloatersidepanelcontainer.cpp llfloatersnapshot.cpp @@ -954,6 +955,7 @@ set(viewer_HEADER_FILES llfloaterscriptlimits.h llfloatersearch.h llfloatersellland.h + llfloatersettingscolor.h llfloatersettingsdebug.h llfloatersidepanelcontainer.h llfloatersnapshot.h @@ -1728,7 +1730,6 @@ if (WINDOWS) ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg ${SHARED_LIB_STAGING_DIR}/openjp2.dll - ${SHARED_LIB_STAGING_DIR}/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/llwebrtc.dll #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/SLVoice.exe #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/libsndfile-1.dll diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 092cd5b87b..1cdc1c4fde 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15784,6 +15784,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>ColorSettingsHideDefault</key> + <map> + <key>Comment</key> + <string>Show non-default settings only in Color Settings list</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>DebugSettingsHideDefault</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4ff73e1fc9..25b9960225 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -642,6 +642,7 @@ LLAppViewer::LLAppViewer() mSavedFinalSnapshot(false), mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded. mQuitRequested(false), + mClosingFloaters(false), mLogoutRequestSent(false), mLastAgentControlFlags(0), mLastAgentForceUpdate(0), @@ -797,7 +798,7 @@ bool LLAppViewer::init() settings_map["floater"] = &gSavedSettings; // *TODO: New settings file settings_map["account"] = &gSavedPerAccountSettings; - LLUI::initParamSingleton(settings_map, + LLUI::createInstance(settings_map, LLUIImageList::getInstance(), ui_audio_callback, deferred_ui_audio_callback); @@ -2150,6 +2151,7 @@ bool LLAppViewer::cleanup() LLViewerEventRecorder::deleteSingleton(); LLWorld::deleteSingleton(); LLVoiceClient::deleteSingleton(); + LLUI::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 @@ -2244,7 +2246,9 @@ void errorCallback(LLError::ELevel level, const std::string &error_string) if (level == LLError::LEVEL_ERROR) { #ifndef LL_RELEASE_FOR_DOWNLOAD - OSMessageBox(error_string, LLTrans::getString("MBFatalError"), OSMB_OK); + std::string message = error_string + + "\n\n\nThis is a developer-only notification!\nThis notification won't be present in Release for download build"; + OSMessageBox(message, LLTrans::getString("MBFatalError"), OSMB_OK); #endif gDebugInfo["FatalMessage"] = error_string; @@ -4032,6 +4036,7 @@ void LLAppViewer::requestQuit() { // application is quitting gFloaterView->closeAllChildren(true); + mClosingFloaters = true; } // Send preferences once, when exiting @@ -4095,6 +4100,7 @@ void LLAppViewer::abortQuit() { LL_INFOS() << "abortQuit()" << LL_ENDL; mQuitRequested = false; + mClosingFloaters = false; } void LLAppViewer::migrateCacheDirectory() @@ -5044,10 +5050,19 @@ void LLAppViewer::idleShutdown() } // Wait for all floaters to get resolved - if (gFloaterView - && !gFloaterView->allChildrenClosed()) + if (gFloaterView) { - return; + if (!mClosingFloaters) + { + // application is quitting + gFloaterView->closeAllChildren(true); + mClosingFloaters = true; + return; + } + if (!gFloaterView->allChildrenClosed()) + { + return; + } } // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup() @@ -5208,6 +5223,23 @@ void LLAppViewer::postToMainCoro(const LL::WorkQueue::Work& work) gMainloopWork.post(work); } +void LLAppViewer::outOfMemorySoftQuit() +{ + if (!mQuitRequested) + { + // Todo: + // Find a way to free at least some memory to make it safer + // Pause decoding and mesh repositorie + getTextureCache()->pause(); + getTextureFetch()->pause(); + LLLFSThread::sLocal->pause(); + gLogoutTimer.reset(); + mQuitRequested = true; + + LLError::LLUserWarningMsg::showOutOfMemory(); + } +} + void LLAppViewer::idleNameCache() { // Neither old nor new name cache can function before agent has a region diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 417ab0fa00..cf5f1ab1e3 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -230,6 +230,12 @@ public: // post given work to the "mainloop" work queue for handling on the main thread void postToMainCoro(const LL::WorkQueue::Work& work); + // Attempt a 'soft' quit with disconnect and saving of settings/cache. + // Intended to be thread safe. + // Good chance of viewer crashing either way, but better than alternatives. + // Note: mQuitRequested can be aborted by user. + void outOfMemorySoftQuit(); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system @@ -317,6 +323,7 @@ private: boost::optional<U32> mForceGraphicsLevel; bool mQuitRequested; // User wants to quit, may have modified documents open. + bool mClosingFloaters; bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. U32 mLastAgentControlFlags; F32 mLastAgentForceUpdate; diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 3fd2b7fe5d..44f35981b0 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -226,14 +226,12 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U // 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() ) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*iter); - if (avatar && - avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) - !avatar->isDead() && // Not dead yet + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isDead() && // Not dead yet !avatar->isControlAvatar() && // Not part of an animated object + avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region { LLSD info = LLSD::emptyMap(); @@ -243,15 +241,14 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U // the weight/complexity is unsigned, but LLSD only stores signed integers, // so if it's over that (which would be ridiculously high), just store the maximum signed int value info[KEY_WEIGHT] = (S32)(avatar_complexity < S32_MAX ? avatar_complexity : S32_MAX); - info[KEY_TOO_COMPLEX] = LLSD::Boolean(avatar->isTooComplex()); + info[KEY_TOO_COMPLEX] = LLSD::Boolean(avatar->isTooComplex()); agents[avatar->getID().asString()] = info; LL_DEBUGS("AvatarRenderInfo") << "Sending avatar render info for " << avatar->getID() - << ": " << info << LL_ENDL; + << ": " << info << LL_ENDL; num_avs++; } } - iter++; } // Reset this regions timer, moving to longer intervals if there are lots of avatars around diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 2b02aabc31..a48e22bc73 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -693,7 +693,7 @@ public: mNeedsTimeBox = false; user_name->setValue(mFrom); updateMinUserNameWidth(); - LLColor4 sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor"); + LLUIColor sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor"); setTransparentColor(sep_color); mTimeBoxTextBox->setVisible(false); } @@ -739,7 +739,7 @@ public: 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"); + LLUIColor userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); style_params_name.color(userNameColor); style_params_name.font.name("SansSerifSmall"); style_params_name.font.style("NORMAL"); @@ -1037,7 +1037,7 @@ private: !av_name.isDisplayNameDefault()) { LLStyle::Params style_params_name; - LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); + LLUIColor userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); style_params_name.color(userNameColor); style_params_name.font.name("SansSerifSmall"); style_params_name.font.style("NORMAL"); @@ -1239,10 +1239,11 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL mMoreChatPanel->reshape(mMoreChatPanel->getRect().getWidth(), height); } - LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); - LLColor4 name_color(txt_color); + F32 alpha = 1.f; + LLUIColor txt_color = LLUIColorTable::instance().getColor("White"); + LLUIColor name_color(txt_color); + LLViewerChat::getChatColor(chat, txt_color, alpha); - LLViewerChat::getChatColor(chat,txt_color); LLFontGL* fontp = LLViewerChat::getChatFont(); std::string font_name = LLFontGL::nameFromFont(fontp); std::string font_size = LLFontGL::sizeFromFont(fontp); @@ -1250,6 +1251,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL LLStyle::Params body_message_params; body_message_params.color(txt_color); body_message_params.readonly_color(txt_color); + body_message_params.alpha(alpha); body_message_params.font.name(font_name); body_message_params.font.size(font_size); body_message_params.font.style(input_append_params.font.style); @@ -1317,7 +1319,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL { if (!message_from_log) { - LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor"); + LLUIColor timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor"); timestamp_style.color(timestamp_color); timestamp_style.readonly_color(timestamp_color); } @@ -1344,7 +1346,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL // 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"); + LLUIColor link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); link_params.color = link_color; link_params.readonly_color = link_color; link_params.is_link = true; diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index a5c26eff9c..550dfeb802 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -134,8 +134,8 @@ void LLFloaterIMNearbyChatToastPanel::addMessage(LLSD& notification) std::string color_name = notification["text_color"].asString(); - LLColor4 textColor = LLUIColorTable::instance().getColor(color_name); - textColor.mV[VALPHA] = (F32)notification["color_alpha"].asReal(); + LLUIColor textColor = LLUIColorTable::instance().getColor(color_name); + F32 textAlpha = (F32)notification["color_alpha"].asReal(); S32 font_size = notification["font_size"].asInteger(); @@ -152,6 +152,7 @@ void LLFloaterIMNearbyChatToastPanel::addMessage(LLSD& notification) { LLStyle::Params style_params; style_params.color(textColor); + style_params.alpha(textAlpha); std::string font_name = LLFontGL::nameFromFont(messageFont); std::string font_style_size = LLFontGL::sizeFromFont(messageFont); style_params.font.name(font_name); @@ -190,8 +191,8 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) std::string color_name = notification["text_color"].asString(); - LLColor4 textColor = LLUIColorTable::instance().getColor(color_name); - textColor.mV[VALPHA] = (F32)notification["color_alpha"].asReal(); + LLUIColor textColor = LLUIColorTable::instance().getColor(color_name); + F32 textAlpha = (F32)notification["color_alpha"].asReal(); S32 font_size = notification["font_size"].asInteger(); @@ -222,14 +223,9 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) 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.color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + style_params_name.font.name = LLFontGL::nameFromFont(messageFont); + style_params_name.font.size = LLFontGL::sizeFromFont(messageFont); style_params_name.link_href = notification["sender_slurl"].asString(); style_params_name.is_link = true; @@ -274,6 +270,7 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification) { LLStyle::Params style_params; style_params.color(textColor); + style_params.alpha(textAlpha); std::string font_name = LLFontGL::nameFromFont(messageFont); std::string font_style_size = LLFontGL::sizeFromFont(messageFont); style_params.font.name(font_name); diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 2a52b7dde9..9201241856 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -699,14 +699,14 @@ bool LLControlAvatar::isImpostor() return LLVOAvatar::isImpostor(); } -//static +// static void LLControlAvatar::onRegionChanged() { - std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin(); - for ( ; it != LLCharacter::sInstances.end(); ++it) + for (LLCharacter* character : LLCharacter::sInstances) { - LLControlAvatar* cav = dynamic_cast<LLControlAvatar*>(*it); - if (!cav) continue; - cav->mRegionChanged = true; + if (LLControlAvatar* cav = dynamic_cast<LLControlAvatar*>(character)) + { + cav->mRegionChanged = true; + } } } diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index eac1ee2a3c..cb2370f413 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -652,6 +652,7 @@ void LLConversationViewParticipant::draw() static LLUIColor sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE); static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); + static LLUIColor sFriendColor = LLUIColorTable::instance().getColor("ConversationFriendColor"); const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false); @@ -661,23 +662,23 @@ void LLConversationViewParticipant::draw() F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad; F32 text_left = (F32)getLabelXPos(); - LLColor4 color; + LLUIColor* color; LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance(); if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID)) { - color = sFgDisabledColor; + color = &sFgDisabledColor; } else { if (LLAvatarActions::isFriend(mUUID)) { - color = LLUIColorTable::instance().getColor("ConversationFriendColor"); + color = &sFriendColor; } else { - color = mIsSelected ? sHighlightFgColor : sFgColor; + color = mIsSelected ? &sHighlightFgColor : &sFgColor; } } @@ -688,7 +689,7 @@ void LLConversationViewParticipant::draw() } drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); - drawLabel(font, text_left, y, color, right_x); + drawLabel(font, text_left, y, color->get(), right_x); LLView::draw(); } diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 0d4eaab488..53d6e528b6 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -241,8 +241,6 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass) F32 screenRes[] = { 1.f / gGLViewport[2], 1.f / gGLViewport[3] }; - S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP); - shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes); shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); @@ -316,8 +314,6 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass) water = static_cast<LLVOWater*>(face->getViewerObject()); if (!water) continue; - gGL.getTexUnit(diffTex)->bind(face->getTexture()); - if ((bool)edge == (bool)water->getIsEdgePatch()) { face->renderIndexed(); @@ -334,7 +330,6 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass) shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); shader->disableTexture(LLShaderMgr::BUMP_MAP); - shader->disableTexture(LLShaderMgr::DIFFUSE_MAP); shader->disableTexture(LLShaderMgr::WATER_REFTEX); // clean up diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index 01a0525d56..ff30c83f51 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -793,12 +793,9 @@ void LLFloater360Capture::freezeWorld(bool enable) LLEnvironment::instance().pauseCloudScroll(); // freeze all avatars - LLCharacter* avatarp; - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + for (LLCharacter* character : LLCharacter::sInstances) { - avatarp = *iter; - mAvatarPauseHandles.push_back(avatarp->requestPause()); + mAvatarPauseHandles.push_back(character->requestPause()); } // freeze everything else diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 2cb930922a..3d81d01e16 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -285,7 +285,12 @@ bool LLFloaterBvhPreview::postBuild() // create data buffer for keyframe initialization S32 buffer_size = loaderp->getOutputSize(); - U8* buffer = new U8[buffer_size]; + U8* buffer = new(std::nothrow) U8[buffer_size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer, size: " << buffer_size << LL_ENDL; + } LLDataPackerBinaryBuffer dp(buffer, buffer_size); @@ -992,7 +997,12 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) LLKeyframeMotion* motionp = (LLKeyframeMotion*)floaterp->mAnimPreview->getDummyAvatar()->findMotion(floaterp->mMotionID); S32 file_size = motionp->getFileSize(); - U8* buffer = new U8[file_size]; + U8* buffer = new(std::nothrow) U8[file_size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer, size: " << file_size << LL_ENDL; + } LLDataPackerBinaryBuffer dp(buffer, file_size); if (motionp->serialize(dp)) diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 603f54fb49..cd45093856 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -110,12 +110,6 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, bool show // create user interface for this picker createUI (); - - if (!mCanApplyImmediately) - { - mApplyImmediateCheck->setEnabled(false); - mApplyImmediateCheck->set(false); - } } LLFloaterColorPicker::~LLFloaterColorPicker() @@ -226,6 +220,12 @@ bool LLFloaterColorPicker::postBuild() mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately")); mApplyImmediateCheck->setCommitCallback(onImmediateCheck, this); + if (!mCanApplyImmediately) + { + mApplyImmediateCheck->setEnabled(false); + mApplyImmediateCheck->set(false); + } + childSetCommitCallback("rspin", onTextCommit, (void*)this ); childSetCommitCallback("gspin", onTextCommit, (void*)this ); childSetCommitCallback("bspin", onTextCommit, (void*)this ); diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 9e69e3d6f9..ffbda0265d 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -185,7 +185,7 @@ public: { mWStr = LLWString(1, emoji); mEmoji = emoji; - mTitle = title; + mTitle = utf8str_to_wstring(title); mBegin = begin; mEnd = end; } @@ -202,10 +202,9 @@ public: F32 centerY = 0.5f * clientHeight; drawIcon(centerX, centerY - 1, iconWidth); - static LLColor4 defaultColor(0.75f, 0.75f, 0.75f, 1.0f); - LLColor4 textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", defaultColor); + static LLUIColor textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4(0.75f, 0.75f, 0.75f, 1.0f)); S32 max_pixels = clientWidth - iconWidth; - drawName((F32)iconWidth, centerY, max_pixels, textColor); + drawName((F32)iconWidth, centerY, max_pixels, textColor.get()); } protected: @@ -225,16 +224,16 @@ protected: max_pixels); // max_pixels } - void drawName(F32 x, F32 y, S32 max_pixels, LLColor4& color) + void drawName(F32 x, F32 y, S32 max_pixels, const LLColor4& color) { F32 x0 = x; F32 x1 = (F32)max_pixels; LLFontGL* font = LLFontGL::getFontEmojiLarge(); if (mBegin) { - std::string text = mTitle.substr(0, mBegin); - font->renderUTF8( - text, // text + LLWString text = mTitle.substr(0, mBegin); + font->render( + text.c_str(), // text 0, // begin_offset x0, // x y, // y @@ -245,14 +244,14 @@ protected: LLFontGL::DROP_SHADOW_SOFT, // shadow static_cast<S32>(text.size()), // max_chars (S32)x1); // max_pixels - F32 dx = font->getWidthF32(text); + F32 dx = font->getWidthF32(text.c_str()); x0 += dx; x1 -= dx; } if (x1 > 0 && mEnd > mBegin) { - std::string text = mTitle.substr(mBegin, mEnd - mBegin); - font->renderUTF8( + LLWString text = mTitle.substr(mBegin, mEnd - mBegin); + font->render( text, // text 0, // begin_offset x0, // x @@ -264,14 +263,14 @@ protected: LLFontGL::DROP_SHADOW_SOFT, // shadow static_cast<S32>(text.size()), // max_chars (S32)x1); // max_pixels - F32 dx = font->getWidthF32(text); + F32 dx = font->getWidthF32(text.c_str()); x0 += dx; x1 -= dx; } if (x1 > 0 && mEnd < mTitle.size()) { - std::string text = mEnd ? mTitle.substr(mEnd) : mTitle; - font->renderUTF8( + LLWString text = mEnd ? mTitle.substr(mEnd) : mTitle; + font->render( text, // text 0, // begin_offset x0, // x @@ -289,7 +288,7 @@ protected: private: llwchar mEmoji; LLWString mWStr; - std::string mTitle; + LLWString mTitle; size_t mBegin; size_t mEnd; }; @@ -428,6 +427,7 @@ void LLFloaterEmojiPicker::fillGroups() for (LLButton* button : mGroupButtons) { mGroups->removeChild(button); + button->die(); } mFilteredEmojiGroups.clear(); mFilteredEmojis.clear(); @@ -442,6 +442,7 @@ void LLFloaterEmojiPicker::fillGroups() rect.mBottom = mBadge->getRect().getHeight(); // Create button for "All categories" + params.name = "all_categories"; createGroupButton(params, rect, ALL_EMOJIS_IMAGE_INDEX); // Create group and button for "Frequently used" @@ -454,6 +455,7 @@ void LLFloaterEmojiPicker::fillGroups() { mFilteredEmojiGroups.push_back(USED_EMOJIS_GROUP_INDEX); mFilteredEmojis.emplace_back(cats); + params.name = "used_categories"; createGroupButton(params, rect, USED_EMOJIS_IMAGE_INDEX); } } @@ -471,6 +473,7 @@ void LLFloaterEmojiPicker::fillGroups() { mFilteredEmojiGroups.push_back(i); mFilteredEmojis.emplace_back(cats); + params.name = "group_" + std::to_string(i); createGroupButton(params, rect, groups[i].Character); } } @@ -665,8 +668,7 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize) LLPanel::Params icon_params; LLRect icon_rect(0, icon_size, icon_size, 0); - static LLColor4 default_color(0.75f, 0.75f, 0.75f, 1.0f); - LLColor4 bg_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", default_color); + static LLUIColor bg_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", LLColor4(0.75f, 0.75f, 0.75f, 1.0f)); if (!mSelectedGroupIndex) { diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 5cf02d1ec0..a614299e03 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -535,14 +535,13 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)// show error in window //("ScriptErrorsAsChat")) { - - LLColor4 txt_color; - - LLViewerChat::getChatColor(chat_msg,txt_color); + LLUIColor txt_color; + F32 alpha = 1.f; + LLViewerChat::getChatColor(chat_msg, txt_color, alpha); LLFloaterScriptDebug::addScriptLine(chat_msg.mText, chat_msg.mFromName, - txt_color, + txt_color % alpha, chat_msg.mFromID); return; } diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 2c6050af94..3eb0c849d3 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -435,15 +435,12 @@ void LLFloaterPerformance::populateNearbyList() mNearbyList->updateColumns(true); static LLCachedControl<U32> max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0); - std::vector<LLCharacter*> valid_nearby_avs; + std::vector<LLVOAvatar*> valid_nearby_avs; mNearbyMaxGPUTime = LLWorld::getInstance()->getNearbyAvatarsAndMaxGPUTime(valid_nearby_avs); - std::vector<LLCharacter*>::iterator char_iter = valid_nearby_avs.begin(); - - while (char_iter != valid_nearby_avs.end()) + for (LLVOAvatar* avatar : valid_nearby_avs) { - LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*char_iter); - if (avatar && (LLVOAvatar::AOA_INVISIBLE != avatar->getOverallAppearance())) + if (LLVOAvatar::AOA_INVISIBLE != avatar->getOverallAppearance()) { F32 render_av_gpu_ms = avatar->getGPURenderTime(); @@ -508,7 +505,6 @@ void LLFloaterPerformance::populateNearbyList() } } } - char_iter++; } mNearbyList->sortByColumnIndex(1, false); mNearbyList->setScrollPos(prev_pos); diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp index a38c4b51f2..fa31cd72c1 100644 --- a/indra/newview/llfloaterscriptedprefs.cpp +++ b/indra/newview/llfloaterscriptedprefs.cpp @@ -54,8 +54,6 @@ bool LLFloaterScriptEdPrefs::postBuild() void LLFloaterScriptEdPrefs::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); - mEditor->initKeywords(); - mEditor->loadKeywords(); } void LLFloaterScriptEdPrefs::getUIColor(LLUICtrl* ctrl, const LLSD& param) diff --git a/indra/newview/llfloatersettingscolor.cpp b/indra/newview/llfloatersettingscolor.cpp new file mode 100644 index 0000000000..d9c382a1dc --- /dev/null +++ b/indra/newview/llfloatersettingscolor.cpp @@ -0,0 +1,334 @@ +/** +* @file llfloatersettingscolor.cpp +* @brief Implementation of LLFloaterSettingsColor +* @author Rye Cogtail<rye@alchemyviewer.org> +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* 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 "llfloatersettingscolor.h" + +#include "llfloater.h" +#include "llfiltereditor.h" +#include "lluictrlfactory.h" +#include "llcombobox.h" +#include "llspinctrl.h" +#include "llcolorswatch.h" +#include "llviewercontrol.h" +#include "lltexteditor.h" + + +LLFloaterSettingsColor::LLFloaterSettingsColor(const LLSD& key) +: LLFloater(key), + mSettingList(NULL) +{ + mCommitCallbackRegistrar.add("CommitSettings", boost::bind(&LLFloaterSettingsColor::onCommitSettings, this)); + mCommitCallbackRegistrar.add("ClickDefault", boost::bind(&LLFloaterSettingsColor::onClickDefault, this)); +} + +LLFloaterSettingsColor::~LLFloaterSettingsColor() +{} + +bool LLFloaterSettingsColor::postBuild() +{ + enableResizeCtrls(true, false, true); + + mAlphaSpinner = getChild<LLSpinCtrl>("alpha_spinner"); + mColorSwatch = getChild<LLColorSwatchCtrl>("color_swatch"); + + mDefaultButton = getChild<LLUICtrl>("default_btn"); + mSettingNameText = getChild<LLTextBox>("color_name_txt"); + + getChild<LLFilterEditor>("filter_input")->setCommitCallback(boost::bind(&LLFloaterSettingsColor::setSearchFilter, this, _2)); + + mSettingList = getChild<LLScrollListCtrl>("setting_list"); + mSettingList->setCommitOnSelectionChange(true); + mSettingList->setCommitCallback(boost::bind(&LLFloaterSettingsColor::onSettingSelect, this)); + + updateList(); + + gSavedSettings.getControl("ColorSettingsHideDefault")->getCommitSignal()->connect(boost::bind(&LLFloaterSettingsColor::updateList, this, false)); + + return LLFloater::postBuild(); +} + +void LLFloaterSettingsColor::draw() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + if(auto cell = first_selected->getColumn(1)) + { + updateControl(cell->getValue().asString()); + } + } + + LLFloater::draw(); +} + +void LLFloaterSettingsColor::onCommitSettings() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (!first_selected) + { + return; + } + auto cell = first_selected->getColumn(1); + + if (!cell) + { + return; + } + + auto color_name = cell->getValue().asString(); + if (color_name.empty()) + { + return; + } + + LLColor4 col4; + LLColor3 col3; + col3.setValue(mColorSwatch->getValue()); + col4 = LLColor4(col3, (F32)mAlphaSpinner->getValue().asReal()); + LLUIColorTable::instance().setColor(color_name, col4); + + updateDefaultColumn(color_name); +} + +// static +void LLFloaterSettingsColor::onClickDefault() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + auto cell = first_selected->getColumn(1); + if (cell) + { + auto name = cell->getValue().asString(); + LLUIColorTable::instance().resetToDefault(name); + updateDefaultColumn(name); + updateControl(name); + } + } +} + +// we've switched controls, or doing per-frame update, so update spinners, etc. +void LLFloaterSettingsColor::updateControl(const std::string& color_name) +{ + hideUIControls(); + + if (!isSettingHidden(color_name)) + { + mDefaultButton->setVisible(true); + mSettingNameText->setVisible(true); + mSettingNameText->setText(color_name); + mSettingNameText->setToolTip(color_name); + + LLColor4 clr = LLUIColorTable::instance().getColor(color_name); + mColorSwatch->setVisible(true); + // only set if changed so color picker doesn't update + if (clr != LLColor4(mColorSwatch->getValue())) + { + mColorSwatch->setOriginal(clr); + } + mAlphaSpinner->setVisible(true); + mAlphaSpinner->setLabel(std::string("Alpha")); + if (!mAlphaSpinner->hasFocus()) + { + mAlphaSpinner->setPrecision(3); + mAlphaSpinner->setMinValue(0.0); + mAlphaSpinner->setMaxValue(1.f); + mAlphaSpinner->setValue(clr.mV[VALPHA]); + } + } + +} + +void LLFloaterSettingsColor::updateList(bool skip_selection) +{ + std::string last_selected; + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(1); + if (cell) + { + last_selected = cell->getValue().asString(); + } + } + + mSettingList->deleteAllItems(); + + const auto& base_colors = LLUIColorTable::instance().getLoadedColors(); + for (const auto& pair : base_colors) + { + const auto& name = pair.first; + if (matchesSearchFilter(name) && !isSettingHidden(name)) + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = LLUIColorTable::instance().isDefault(name) ? "" : "*"; + + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = name; + + LLScrollListItem* item = mSettingList->addElement(row, ADD_BOTTOM, nullptr); + if (!mSearchFilter.empty() && (last_selected == name) && !skip_selection) + { + std::string lower_name(name); + LLStringUtil::toLower(lower_name); + if (LLStringUtil::startsWith(lower_name, mSearchFilter)) + { + item->setSelected(true); + } + } + } + } + + for (const auto& pair : LLUIColorTable::instance().getUserColors()) + { + const auto& name = pair.first; + if (base_colors.find(name) == base_colors.end() && matchesSearchFilter(name) && !isSettingHidden(name)) + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = LLUIColorTable::instance().isDefault(name) ? "" : "*"; + + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = name; + + LLScrollListItem* item = mSettingList->addElement(row, ADD_BOTTOM, nullptr); + if (!mSearchFilter.empty() && (last_selected == name) && !skip_selection) + { + std::string lower_name(name); + LLStringUtil::toLower(lower_name); + if (LLStringUtil::startsWith(lower_name, mSearchFilter)) + { + item->setSelected(true); + } + } + } + } + + mSettingList->updateSort(); + + if (!mSettingList->isEmpty()) + { + if (mSettingList->hasSelectedItem()) + { + mSettingList->scrollToShowSelected(); + } + else if (!mSettingList->hasSelectedItem() && !mSearchFilter.empty() && !skip_selection) + { + if (!mSettingList->selectItemByPrefix(mSearchFilter, false, 1)) + { + mSettingList->selectFirstItem(); + } + mSettingList->scrollToShowSelected(); + } + } + else + { + LLSD row; + + row["columns"][0]["column"] = "changed_color"; + row["columns"][0]["value"] = ""; + row["columns"][1]["column"] = "color"; + row["columns"][1]["value"] = "No matching colors."; + + mSettingList->addElement(row); + hideUIControls(); + } +} + +void LLFloaterSettingsColor::onSettingSelect() +{ + LLScrollListItem* first_selected = mSettingList->getFirstSelected(); + if (first_selected) + { + auto cell = first_selected->getColumn(1); + if (cell) + { + updateControl(cell->getValue().asString()); + } + } +} + +void LLFloaterSettingsColor::setSearchFilter(const std::string& filter) +{ + if(mSearchFilter == filter) + return; + mSearchFilter = filter; + LLStringUtil::toLower(mSearchFilter); + updateList(); +} + +bool LLFloaterSettingsColor::matchesSearchFilter(std::string setting_name) +{ + // If the search filter is empty, everything passes. + if (mSearchFilter.empty()) return true; + + LLStringUtil::toLower(setting_name); + std::string::size_type match_name = setting_name.find(mSearchFilter); + + return (std::string::npos != match_name); +} + +bool LLFloaterSettingsColor::isSettingHidden(const std::string& color_name) +{ + static LLCachedControl<bool> hide_default(gSavedSettings, "ColorSettingsHideDefault", false); + return hide_default && LLUIColorTable::instance().isDefault(color_name); +} + +void LLFloaterSettingsColor::updateDefaultColumn(const std::string& color_name) +{ + if (isSettingHidden(color_name)) + { + hideUIControls(); + updateList(true); + return; + } + + LLScrollListItem* item = mSettingList->getFirstSelected(); + if (item) + { + LLScrollListCell* cell = item->getColumn(0); + if (cell) + { + std::string is_default = LLUIColorTable::instance().isDefault(color_name) ? "" : "*"; + cell->setValue(is_default); + } + } +} + +void LLFloaterSettingsColor::hideUIControls() +{ + mColorSwatch->setVisible(false); + mAlphaSpinner->setVisible(false); + mDefaultButton->setVisible(false); + mSettingNameText->setVisible(false); +} + diff --git a/indra/newview/llfloatersettingscolor.h b/indra/newview/llfloatersettingscolor.h new file mode 100644 index 0000000000..42eb85cd60 --- /dev/null +++ b/indra/newview/llfloatersettingscolor.h @@ -0,0 +1,81 @@ +/** +* @file llfloatersettingscolor.h +* @brief Header file for LLFloaterSettingsColor +* @author Rye Cogtail<rye@alchemyviewer.org> +* +* $LicenseInfo:firstyear=2024&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2024, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* 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 LLFLOATERCOLORSETTINGS_H +#define LLFLOATERCOLORSETTINGS_H + +#include "llcontrol.h" +#include "llfloater.h" + +class LLColorSwatchCtrl; +class LLScrollListCtrl; +class LLSpinCtrl; +class LLTextBox; + +class LLFloaterSettingsColor final +: public LLFloater +{ + friend class LLFloaterReg; + +public: + + bool postBuild() override; + void draw() override; + + void updateControl(const std::string& color_name); + + void onCommitSettings(); + void onClickDefault(); + + bool matchesSearchFilter(std::string setting_name); + bool isSettingHidden(const std::string& color_name); + +private: + LLFloaterSettingsColor(const LLSD& key); + virtual ~LLFloaterSettingsColor(); + + void updateList(bool skip_selection = false); + void onSettingSelect(); + void setSearchFilter(const std::string& filter); + + void updateDefaultColumn(const std::string& color_name); + void hideUIControls(); + + LLScrollListCtrl* mSettingList; + +protected: + LLUICtrl* mDefaultButton = nullptr; + LLTextBox* mSettingNameText = nullptr; + + LLSpinCtrl* mAlphaSpinner = nullptr; + LLColorSwatchCtrl* mColorSwatch = nullptr; + + std::string mSearchFilter; +}; + +#endif //LLFLOATERCOLORSETTINGS_H + diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index ddc567c029..ddd55d0c17 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -210,13 +210,10 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate previewp->setEnabled(true); } - //RN: freeze all avatars - LLCharacter* avatarp; - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + // RN: freeze all avatars + for (LLCharacter* character : LLCharacter::sInstances) { - avatarp = *iter; - floaterp->impl->mAvatarPauseHandles.push_back(avatarp->requestPause()); + floaterp->impl->mAvatarPauseHandles.push_back(character->requestPause()); } // freeze everything else diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 8d74a99539..fc2cfbcf2b 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -261,6 +261,48 @@ void LLMapFriendObserver::changed(U32 mask) } } +LLWorldMapParcelInfoObserver::LLWorldMapParcelInfoObserver(const LLVector3d& pos_global) + : LLRemoteParcelInfoObserver(), + mPosGlobal(pos_global), + mParcelID(LLUUID::null) +{ } + +LLWorldMapParcelInfoObserver::~LLWorldMapParcelInfoObserver() +{ + if (mParcelID.notNull()) + { + LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this); + } +} + +void LLWorldMapParcelInfoObserver::processParcelInfo(const LLParcelData& parcel_data) +{ + if (parcel_data.parcel_id == mParcelID) + { + LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this); + + if (gFloaterWorldMap) + { + gFloaterWorldMap->processParcelInfo(parcel_data, mPosGlobal); + } + } +} + +// virtual +void LLWorldMapParcelInfoObserver::setParcelID(const LLUUID& parcel_id) +{ + mParcelID = parcel_id; + auto instance = LLRemoteParcelInfoProcessor::getInstance(); + instance->addObserver(mParcelID, this); + instance->sendParcelInfoRequest(mParcelID); +} + +// virtual +void LLWorldMapParcelInfoObserver::setErrorStatus(S32 status, const std::string& reason) +{ + LL_WARNS("LLWorldMapParcelInfoObserver") << "Can't handle remote parcel request." << " Http Status: " << status << ". Reason : " << reason << LL_ENDL; +} + //--------------------------------------------------------------------------- // Statics //--------------------------------------------------------------------------- @@ -275,23 +317,25 @@ const LLUUID LLFloaterWorldMap::sHomeID( "10000000-0000-0000-0000-000000000001" LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key) : LLFloater(key), - mInventory(NULL), - mInventoryObserver(NULL), - mFriendObserver(NULL), + mInventory(nullptr), + mInventoryObserver(nullptr), + mFriendObserver(nullptr), mCompletingRegionName(), mCompletingRegionPos(), mWaitingForTracker(false), mIsClosing(false), mSetToUserPosition(true), - mTrackedLocation(0,0,0), + mTrackedLocation(0.0,0.0,0.0), mTrackedStatus(LLTracker::TRACKING_NOTHING), - mListFriendCombo(NULL), - mListLandmarkCombo(NULL), - mListSearchResults(NULL) + mListFriendCombo(nullptr), + mListLandmarkCombo(nullptr), + mListSearchResults(nullptr), + mParcelInfoObserver(nullptr), + mShowParcelInfo(false) { gFloaterWorldMap = this; - mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL); + mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, nullptr); mCommitCallbackRegistrar.add("WMap.Coordinates", boost::bind(&LLFloaterWorldMap::onCoordinatesCommit, this)); mCommitCallbackRegistrar.add("WMap.Location", boost::bind(&LLFloaterWorldMap::onLocationCommit, this)); @@ -374,6 +418,11 @@ bool LLFloaterWorldMap::postBuild() // virtual LLFloaterWorldMap::~LLFloaterWorldMap() { + if (mParcelInfoObserver) + { + delete mParcelInfoObserver; + } + // All cleaned up by LLView destructor mMapView = NULL; @@ -584,9 +633,73 @@ void LLFloaterWorldMap::draw() // Internal utility functions //------------------------------------------------------------------------- +void LLFloaterWorldMap::processParcelInfo(const LLParcelData& parcel_data, const LLVector3d& pos_global) const +{ + LLVector3d tracker_pos = LLTracker::getTrackedPositionGlobal(); + if (!mShowParcelInfo || + (tracker_pos.mdV[VX] != pos_global.mdV[VX] && tracker_pos.mdV[VY] != pos_global.mdV[VY]) || + LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING || + LLTracker::getTrackingStatus() != LLTracker::TRACKING_LOCATION) + { + return; + } + + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); + if (!sim_info) + { + return; + } + + std::string sim_name = sim_info->getName(); + U32 locX, locY; + from_region_handle(sim_info->getHandle(), &locX, &locY); + F32 region_x = (F32)(pos_global.mdV[VX] - locX); + F32 region_y = (F32)(pos_global.mdV[VY] - locY); + 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])); + + LLTracker::trackLocation(pos_global, parcel_data.name.empty() ? getString("UnnamedParcel") : parcel_data.name, full_name); +} + +void LLFloaterWorldMap::requestParcelInfo(const LLVector3d& pos_global, const LLVector3d& region_origin) +{ + if (pos_global == mRequestedGlobalPos) + { + return; + } + + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + { + return; + } + + if (std::string url = region->getCapability("RemoteParcelRequest"); !url.empty()) + { + mRequestedGlobalPos = pos_global; + if (mParcelInfoObserver) + { + delete mParcelInfoObserver; + } + mParcelInfoObserver = new LLWorldMapParcelInfoObserver(pos_global); + + auto pos_region = LLVector3(pos_global - region_origin); + LLRemoteParcelInfoProcessor::instance().requestRegionParcelInfo(url, + region->getRegionID(), pos_region, pos_global, + mParcelInfoObserver->getObserverHandle()); + } + else + { + LL_WARNS() << "Cannot request parcel details: Cap not found" << LL_ENDL; + } +} void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& name ) { + mShowParcelInfo = false; LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); if (!iface) return; @@ -617,6 +730,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) { + mShowParcelInfo = false; LLCtrlSelectionInterface *iface = childGetSelectionInterface("landmark combo"); if (!iface) return; @@ -662,6 +776,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info) { + mShowParcelInfo = false; mTrackedStatus = LLTracker::TRACKING_LOCATION; LLTracker::trackLocation(event_info.getGlobalPosition(), event_info.getName(), event_info.getToolTip(), LLTracker::LOCATION_EVENT); setDefaultBtn("Teleport"); @@ -669,6 +784,7 @@ void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info) void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item) { + mShowParcelInfo = false; mTrackedStatus = LLTracker::TRACKING_LOCATION; LLTracker::trackLocation(item.getGlobalPosition(), item.getName(), item.getToolTip(), LLTracker::LOCATION_ITEM); setDefaultBtn("Teleport"); @@ -721,6 +837,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking LLTracker::trackLocation(pos_global, full_name, tooltip); + mShowParcelInfo = true; + requestParcelInfo(pos_global, sim_info->getGlobalOrigin()); + LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal(); updateTeleportCoordsDisplay( coord_pos ); diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index a99100f5bd..2f2b2b7a0d 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -34,8 +34,9 @@ #include "llfloater.h" #include "llmapimagetype.h" -#include "lltracker.h" +#include "llremoteparcelrequest.h" #include "llslurl.h" +#include "lltracker.h" class LLCtrlListInterface; class LLFriendObserver; @@ -51,6 +52,21 @@ class LLSliderCtrl; class LLSpinCtrl; class LLSearchEditor; +class LLWorldMapParcelInfoObserver : public LLRemoteParcelInfoObserver +{ +public: + LLWorldMapParcelInfoObserver(const LLVector3d& pos_global); + ~LLWorldMapParcelInfoObserver(); + + void processParcelInfo(const LLParcelData& parcel_data); + void setParcelID(const LLUUID& parcel_id); + void setErrorStatus(S32 status, const std::string& reason); + +protected: + LLVector3d mPosGlobal; + LLUUID mParcelID; +}; + class LLFloaterWorldMap : public LLFloater { public: @@ -119,6 +135,8 @@ public: //Slapp instigated avatar tracking void avatarTrackFromSlapp( const LLUUID& id ); + void processParcelInfo(const LLParcelData& parcel_data, const LLVector3d& pos_global) const; + protected: void onGoHome(); @@ -169,8 +187,13 @@ private: // enable/disable teleport destination coordinates void enableTeleportCoordsDisplay( bool enabled ); - std::vector<LLUUID> mLandmarkAssetIDList; - std::vector<LLUUID> mLandmarkItemIDList; + void requestParcelInfo(const LLVector3d& pos_global, const LLVector3d& region_origin); + LLVector3d mRequestedGlobalPos; + bool mShowParcelInfo; + LLWorldMapParcelInfoObserver* mParcelInfoObserver; + + uuid_vec_t mLandmarkAssetIDList; + uuid_vec_t mLandmarkItemIDList; static const LLUUID sHomeID; diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 4011a857e5..205089c662 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -279,8 +279,10 @@ void LLHUDNameTag::renderText(bool for_select) 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); + static LLCachedControl<F32> bubble_opacity(gSavedSettings, "ChatBubbleOpacity"); + static LLUIColor nametag_bg_color = LLUIColorTable::instance().getColor("NameTagBackground"); + LLColor4 bg_color = nametag_bg_color; + bg_color.setAlpha(bubble_opacity * alpha_factor); // scale screen size of borders down //RN: for now, text on hud objects is never occluded @@ -340,8 +342,7 @@ void LLHUDNameTag::renderText(bool for_select) 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; + LLColor4 label_color(0.f, 0.f, 0.f, alpha_factor); hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); } } diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 35bcf65db6..fd0d8b696f 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -138,8 +138,10 @@ void LLHUDText::renderText() 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); + static LLCachedControl<F32> bubble_opacity(gSavedSettings, "ChatBubbleOpacity"); + static LLUIColor nametag_bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor"); + LLColor4 bg_color = nametag_bg_color; + bg_color.setAlpha(bubble_opacity * alpha_factor); const S32 border_height = 16; const S32 border_width = 16; diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 98b3707457..9e6cf7ac73 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -221,9 +221,10 @@ void LLInventoryGallery::setRootFolder(const LLUUID cat_id) for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(false); + item->setSelected(false); } } @@ -348,7 +349,7 @@ void LLInventoryGallery::initGallery() mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) { - addToGallery(mItemMap[cats[i]]); + addToGallery(getItem(cats[i])); } reArrangeRows(); mGalleryCreated = true; @@ -656,6 +657,16 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L return gitem; } +LLInventoryGalleryItem* LLInventoryGallery::getItem(const LLUUID& id) const +{ + auto it = mItemMap.find(id); + if (it != mItemMap.end()) + { + return it->second; + } + return nullptr; +} + void LLInventoryGallery::buildGalleryPanel(int row_count) { LLPanel::Params params; @@ -1006,14 +1017,15 @@ void LLInventoryGallery::updateItemThumbnail(LLUUID item_id) thumbnail_id = getOutfitImageID(item_id); } - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setLoadImmediately(mLoadThumbnailsImmediately); - mItemMap[item_id]->setThumbnail(thumbnail_id); + item->setLoadImmediately(mLoadThumbnailsImmediately); + item->setThumbnail(thumbnail_id); - bool passes_filter = checkAgainstFilters(mItemMap[item_id], mFilterSubString); - if((mItemMap[item_id]->isHidden() && passes_filter) - || (!mItemMap[item_id]->isHidden() && !passes_filter)) + bool passes_filter = checkAgainstFilters(item, mFilterSubString); + if((item->isHidden() && passes_filter) + || (!item->isHidden() && !passes_filter)) { reArrangeRows(); } @@ -1169,7 +1181,7 @@ void LLInventoryGallery::moveUp(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { if (mask == MASK_NONE || mask == MASK_CONTROL) @@ -1214,7 +1226,7 @@ void LLInventoryGallery::moveDown(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { if (mask == MASK_NONE || mask == MASK_CONTROL) @@ -1259,11 +1271,7 @@ void LLInventoryGallery::moveLeft(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; - if (mask == MASK_SHIFT) - { - item = mItemMap[mLastInteractedUUID]; - } + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { // Might be better to get item from panel @@ -1307,7 +1315,7 @@ void LLInventoryGallery::moveRight(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { S32 n = mItemIndexMap[item]; @@ -1373,8 +1381,8 @@ void LLInventoryGallery::toggleSelectionRangeFromLast(const LLUUID target) { return; } - LLInventoryGalleryItem* last_item = mItemMap[mLastInteractedUUID]; - LLInventoryGalleryItem* next_item = mItemMap[target]; + LLInventoryGalleryItem* last_item = getItem(mLastInteractedUUID); + LLInventoryGalleryItem* next_item = getItem(target); if (last_item && next_item) { S32 last_idx = mItemIndexMap[last_item]; @@ -1417,9 +1425,10 @@ void LLInventoryGallery::onFocusLost() for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(false); + item->setSelected(false); } } } @@ -1435,9 +1444,10 @@ void LLInventoryGallery::onFocusReceived() LLInventoryGalleryItem* focus_item = NULL; for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id] && !mItemMap[id]->isHidden()) + LLInventoryGalleryItem* item = getItem(id); + if (item && !item->isHidden()) { - focus_item = mItemMap[id]; + focus_item = item; focus_item->setSelected(true); } } @@ -1478,9 +1488,10 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ { for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(false); + item->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1499,9 +1510,10 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ return; } - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(true); + item->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1527,9 +1539,10 @@ void LLInventoryGallery::addItemSelection(const LLUUID& item_id, bool scroll_to_ return; } - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(true); + item->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1552,18 +1565,20 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ selection_deque::iterator found = std::find(mSelectedItemIDs.begin(), mSelectedItemIDs.end(), item_id); if (found != mSelectedItemIDs.end()) { - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(false); + item->setSelected(false); } mSelectedItemIDs.erase(found); result = false; } else { - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(true); + item->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1580,7 +1595,7 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ void LLInventoryGallery::scrollToShowItem(const LLUUID& item_id) { - LLInventoryGalleryItem* item = mItemMap[item_id]; + LLInventoryGalleryItem* item = getItem(item_id); if(item) { const LLRect visible_content_rect = mScrollPanel->getVisibleContentRect(); @@ -1610,7 +1625,7 @@ LLInventoryGalleryItem* LLInventoryGallery::getFirstSelectedItem() if (mSelectedItemIDs.size() > 0) { selection_deque::iterator iter = mSelectedItemIDs.begin(); - return mItemMap[*iter]; + return getItem(*iter); } return NULL; } @@ -1768,9 +1783,10 @@ void LLInventoryGallery::paste() { for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(false); + item->setSelected(false); } } mSelectedItemIDs.clear(); @@ -2108,9 +2124,10 @@ void LLInventoryGallery::pasteAsLink() { for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(false); + item->setSelected(false); } } mSelectedItemIDs.clear(); @@ -2433,10 +2450,10 @@ void LLInventoryGallery::onGesturesChanged() void LLInventoryGallery::deselectItem(const LLUUID& category_id) { // Reset selection if the item is selected. - LLInventoryGalleryItem* item = mItemMap[category_id]; + LLInventoryGalleryItem* item = getItem(category_id); if (item && item->isSelected()) { - mItemMap[category_id]->setSelected(false); + item->setSelected(false); setFocus(true); // Todo: support multiselect // signalSelectionItemID(LLUUID::null); @@ -2453,9 +2470,10 @@ void LLInventoryGallery::clearSelection() { for (const LLUUID& id: mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(false); + item->setSelected(false); } } if (!mSelectedItemIDs.empty()) @@ -2863,11 +2881,13 @@ void LLInventoryGalleryItem::draw() LLPanel::draw(); // Draw border - LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "MenuItemHighlightBgColor" : "TextFgTentativeColor", LLColor4::white); + static LLUIColor menu_highlighted_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", LLColor4::white);; + static LLUIColor text_fg_tentative_color = LLUIColorTable::instance().getColor("TextFgTentativeColor", LLColor4::white);; + const LLColor4& border_color = mSelected ? menu_highlighted_color : text_fg_tentative_color; LLRect border = mThumbnailCtrl->getRect(); border.mRight = border.mRight + 1; border.mTop = border.mTop + 1; - gl_rect_2d(border, border_color.get(), false); + gl_rect_2d(border, border_color, false); } } diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index afc7bdc9f8..59d08d19ed 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -228,6 +228,7 @@ private: void updateGalleryWidth(); LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn); + LLInventoryGalleryItem* getItem(const LLUUID& id) const; void buildGalleryPanel(int row_count); void reshapeGalleryPanel(int row_count); diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 0de8f00418..3fdf7bd925 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -591,9 +591,9 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string 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"); + static LLUIColor grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor"); + static LLUIColor grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor"); + static LLUIColor grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor"); LLColor4 line_color; F32 line_alpha = gSavedSettings.getF32("GridOpacity"); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 1c64ed6822..349df11f35 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1361,7 +1361,17 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) if (!buffer) { LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL; - return false; + + // Not sure what size is reasonable for skin info, + // but if 20MB allocation failed, we definetely have issues + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB + if (size < MAX_SIZE) + { + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large data + LLMutexLock locker(mMutex); + mSkinUnavailableQ.emplace_back(mesh_id); + return true; } LLMeshRepository::sCacheBytesRead += size; ++LLMeshRepository::sCacheReads; @@ -1474,7 +1484,15 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) if (!buffer) { LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; - return false; + + // Not sure what size is reasonable for decomposition + // but if 20MB allocation failed, we definetely have issues + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB + if (size < MAX_SIZE) + { + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large decompositiions + return true; } LLMeshRepository::sCacheBytesRead += size; ++LLMeshRepository::sCacheReads; @@ -1575,8 +1593,16 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) 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; + LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; + + // Not sure what size is reasonable for physcis + // but if 20MB allocation failed, we definetely have issues + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB + if (size < MAX_SIZE) + { + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large data + return true; } file.read(buffer, size); @@ -1767,9 +1793,17 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, 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; + + // Not sure what size is reasonable for a mesh, + // but if 20MB allocation failed, we definetely have issues + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB + if (size < MAX_SIZE) + { + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large data + LLMutexLock lock(mMutex); + mUnavailableQ.push_back(LODRequest(mesh_params, lod)); + return true; } LLMeshRepository::sCacheBytesRead += size; ++LLMeshRepository::sCacheReads; @@ -2329,10 +2363,11 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) // We want to be able to allow more than 8 materials... // - S32 end = llmin((S32)instance.mMaterial.size(), instance.mModel->getNumVolumeFaces()) ; + S32 end = llmin((S32)data.mBaseModel->mMaterialList.size(), instance.mModel->getNumVolumeFaces()) ; for (S32 face_num = 0; face_num < end; face_num++) { + // multiple faces can reuse the same material LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]]; LLSD face_entry = LLSD::emptyMap(); diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 7482890d1e..d7df9ceadc 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -128,7 +128,7 @@ void LLOutfitGallery::onOpen(const LLSD& info) mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) { - addToGallery(mOutfitMap[cats[i]]); + addToGallery(getItem(cats[i])); } reArrangeRows(); mGalleryCreated = true; @@ -377,7 +377,7 @@ void LLOutfitGallery::onOutfitsRemovalConfirmation(const LLSD& notification, con void LLOutfitGallery::scrollToShowItem(const LLUUID& item_id) { - LLOutfitGalleryItem* item = mOutfitMap[item_id]; + LLOutfitGalleryItem* item = getItem(item_id); if (item) { const LLRect visible_content_rect = mScrollPanel->getVisibleContentRect(); @@ -525,6 +525,10 @@ LLPanel* LLOutfitGallery::addToRow(LLPanel* row_stack, LLOutfitGalleryItem* item void LLOutfitGallery::addToGallery(LLOutfitGalleryItem* item) { + if (!item) + { + return; + } if(item->isHidden()) { mHiddenItems.push_back(item); @@ -632,9 +636,19 @@ LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID return gitem; } -LLOutfitGalleryItem* LLOutfitGallery::getSelectedItem() +LLOutfitGalleryItem* LLOutfitGallery::getSelectedItem() const +{ + return getItem(mSelectedOutfitUUID); +} + +LLOutfitGalleryItem* LLOutfitGallery::getItem(const LLUUID& id) const { - return mOutfitMap[mSelectedOutfitUUID]; + auto it = mOutfitMap.find(id); + if (it != mOutfitMap.end()) + { + return it->second; + } + return nullptr; } void LLOutfitGallery::buildGalleryPanel(int row_count) @@ -1006,8 +1020,8 @@ void LLOutfitGalleryItem::setOutfitWorn(bool value) LLStringUtil::format_map_t worn_string_args; std::string worn_string = getString("worn_string", worn_string_args); LLUIColor text_color = LLUIColorTable::instance().getColor("White", LLColor4::white); - mOutfitWornText->setReadOnlyColor(text_color.get()); - mOutfitNameText->setReadOnlyColor(text_color.get()); + mOutfitWornText->setReadOnlyColor(text_color); + mOutfitNameText->setReadOnlyColor(text_color); mOutfitWornText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); mOutfitNameText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); mOutfitWornText->setValue(value ? worn_string : ""); @@ -1275,7 +1289,15 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) } if (asset_id.notNull()) { - photo_loaded |= mOutfitMap[category_id]->setImageAssetId(asset_id); + LLOutfitGalleryItem* item = getItem(category_id); + if (item) + { + photo_loaded |= item->setImageAssetId(asset_id); + } + else + { + photo_loaded = true; + } // Rename links if (!mOutfitRenamePending.isNull() && mOutfitRenamePending.asString() == item_name) { @@ -1301,13 +1323,21 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) } if (!photo_loaded) { - mOutfitMap[category_id]->setDefaultImage(); + LLOutfitGalleryItem* item = getItem(category_id); + if (item) + { + item->setDefaultImage(); + } } } } else { - mOutfitMap[category_id]->setImageAssetId(asset_id); + LLOutfitGalleryItem* item = getItem(category_id); + if (item) + { + item->setImageAssetId(asset_id); + } } } diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index 5b2a33d0ca..fa441ff209 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -135,7 +135,8 @@ private: void updateGalleryWidth(); LLOutfitGalleryItem* buildGalleryItem(std::string name, LLUUID outfit_id); - LLOutfitGalleryItem* getSelectedItem(); + LLOutfitGalleryItem* getSelectedItem() const; + LLOutfitGalleryItem* getItem(const LLUUID& id) const; void onTextureSelectionChanged(LLInventoryItem* itemp); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index aa35335ad9..0ce1f0f9d3 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -399,7 +399,7 @@ void LLPanelPermissions::refresh() // Style for creator and owner links (both group and agent) LLStyle::Params style_params; - LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + LLUIColor 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 diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 31fd6f3f07..8d164b6883 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -220,7 +220,7 @@ F32 LLReflectionMap::getNearClip() if (mViewerObject && mViewerObject->getVolume()) { - ret = ((LLVOVolume*)mViewerObject)->getReflectionProbeNearClip(); + ret = mViewerObject->getReflectionProbeNearClip(); } else if (mGroup) { @@ -240,7 +240,7 @@ bool LLReflectionMap::getIsDynamic() mViewerObject && mViewerObject->getVolume()) { - return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic(); + return mViewerObject->getReflectionProbeIsDynamic(); } return false; diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index cdccaf44e9..7498c2d524 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -225,11 +225,10 @@ void LLSceneMonitor::freezeScene() return; } - //freeze all avatars - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + // freeze all avatars + for (LLCharacter* character : LLCharacter::sInstances) { - freezeAvatar((LLCharacter*)(*iter)); + freezeAvatar((LLCharacter*)character); } // freeze everything else diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp index 6f23477415..59cf3ac02b 100644 --- a/indra/newview/llscripteditor.cpp +++ b/indra/newview/llscripteditor.cpp @@ -122,7 +122,7 @@ void LLScriptEditor::drawLineNumbers() 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; + const LLColor4& fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor; getScriptFont()->render( ltext, // string to draw 0, // begin offset diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index fcd1c84ba4..342048252f 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -128,12 +128,12 @@ 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; -LLColor4 LLSelectMgr::sHighlightParentColor; -LLColor4 LLSelectMgr::sHighlightChildColor; -LLColor4 LLSelectMgr::sContextSilhouetteColor; +LLUIColor LLSelectMgr::sSilhouetteParentColor; +LLUIColor LLSelectMgr::sSilhouetteChildColor; +LLUIColor LLSelectMgr::sHighlightInspectColor; +LLUIColor LLSelectMgr::sHighlightParentColor; +LLUIColor LLSelectMgr::sHighlightChildColor; +LLUIColor LLSelectMgr::sContextSilhouetteColor; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // struct LLDeRezInfo @@ -6437,8 +6437,10 @@ void LLSelectMgr::renderSilhouettes(bool for_hud) 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); + LLColor4 sParentColor = sSilhouetteParentColor; + sParentColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; + LLColor4 sChildColor = sSilhouetteChildColor; + sChildColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor) { @@ -8006,12 +8008,9 @@ S32 LLObjectSelection::getSelectedObjectRenderCost() 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) + const const_child_list_t& children = object->getChildren(); + for (LLViewerObject* child_obj : children) { - LLViewerObject* child_obj = *child_iter; LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj ); if (child) { diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 355e28595b..2764b0179c 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -44,6 +44,7 @@ #include "llcontrol.h" #include "llviewerobject.h" // LLObjectSelection::getSelectedTEValue template #include "llmaterial.h" +#include "lluicolor.h" #include <deque> #include <boost/iterator/filter_iterator.hpp> @@ -450,12 +451,12 @@ public: 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; + static LLUIColor sSilhouetteParentColor; + static LLUIColor sSilhouetteChildColor; + static LLUIColor sHighlightParentColor; + static LLUIColor sHighlightChildColor; + static LLUIColor sHighlightInspectColor; + static LLUIColor sContextSilhouetteColor; LLCachedControl<bool> mHideSelectedObjects; LLCachedControl<bool> mRenderHighlightSelections; diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 7775e3d9f6..fccf745a74 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -351,7 +351,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) // Style for creator and owner links LLStyle::Params style_params; - LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); + LLUIColor 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 diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 81002139be..7480a18d9f 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -368,8 +368,8 @@ void LLSpeakerMgr::update(bool resort_ok) return; } - LLColor4 speaking_color = LLUIColorTable::instance().getColor("SpeakingColor"); - LLColor4 overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor"); + static const LLUIColor speaking_color = LLUIColorTable::instance().getColor("SpeakingColor"); + static const LLUIColor overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor"); if(resort_ok) // only allow list changes when user is not interacting with it { diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 689c555998..69c40066b4 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -467,14 +467,6 @@ private: // 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(); @@ -592,21 +584,6 @@ private: // 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; @@ -922,9 +899,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mRetryAttempt(0), mActiveCount(0), mWorkMutex(), - mFirstPacket(0), - mLastPacket(-1), - mTotalPackets(0), mImageCodec(IMG_CODEC_INVALID), mMetricsStartTime(0), mHttpHandle(LLCORE_HTTP_HANDLE_INVALID), @@ -980,7 +954,6 @@ LLTextureFetchWorker::~LLTextureFetchWorker() mFetcher->mTextureCache->writeComplete(mCacheWriteHandle, true); } mFormattedImage = NULL; - clearPackets(); if (mHttpBufferArray) { mHttpBufferArray->release(); @@ -992,16 +965,6 @@ LLTextureFetchWorker::~LLTextureFetchWorker() 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; -} - // Locks: Mw (ctor invokes without lock) void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size) { @@ -1164,7 +1127,6 @@ bool LLTextureFetchWorker::doWork(S32 param) mHttpReplySize = 0; mHttpReplyOffset = 0; mHaveAllData = false; - clearPackets(); // TODO: Shouldn't be necessary mCacheReadHandle = LLTextureCache::nullHandle(); mCacheWriteHandle = LLTextureCache::nullHandle(); setState(LOAD_FROM_TEXTURE_CACHE); @@ -2441,8 +2403,6 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mod : LLWorkerThread("TextureFetch", threaded, true), mDebugCount(0), mDebugPause(false), - mPacketCount(0), - mBadPacketCount(0), mQueueMutex(), mNetworkQueueMutex(), mTextureCache(cache), @@ -3066,43 +3026,6 @@ void LLTextureFetch::threadedUpdate() #endif } -////////////////////////////////////////////////////////////////////////////// - -// Threads: T* -// Locks: Mw -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; -} - void LLTextureFetchWorker::setState(e_state new_state) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index aebd2f8f95..3405f76e37 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -293,8 +293,6 @@ public: LLUUID mDebugID; S32 mDebugCount; bool mDebugPause; - S32 mPacketCount; - S32 mBadPacketCount; static LLTrace::CountStatHandle<F64> sCacheHit; static LLTrace::CountStatHandle<F64> sCacheAttempt; diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 92527fc3a9..e5a61b359d 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -323,13 +323,6 @@ void LLTextureBar::draw() { 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(), @@ -620,10 +613,9 @@ void LLGLTexMemBar::draw() //---------------------------------------------------------------------------- - 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 ", + text = llformat("Textures: %d Fetch: %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, diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 5180b1808c..0063e0b7fd 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -566,7 +566,7 @@ void LLToolBarView::draw() // Draw drop zones if drop of a tool is active if (isToolDragged()) { - LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" ); + static const LLUIColor drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" ); for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++) { diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 50128d826a..b74b48b9f6 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -479,7 +479,12 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() else { S32 size = LLAPRFile::size(getFileName()); - U8* buffer = new U8[size]; + U8* buffer = new(std::nothrow) U8[size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer, size: " << size << LL_ENDL; + } S32 size_read = infile.read(buffer,size); if (size_read != size) { diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 597cf3c98c..8b01c4ef88 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -41,7 +41,7 @@ LLViewerChat::font_change_signal_t LLViewerChat::sChatFontChangedSignal; //static -void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) +void LLViewerChat::getChatColor(const LLChat& chat, LLUIColor& r_color, F32& r_color_alpha) { if(chat.mMuted) { @@ -90,7 +90,7 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) } break; default: - r_color.setToWhite(); + r_color = LLUIColorTable::instance().getColor("White"); } if (!chat.mPosAgent.isExactlyZero()) @@ -101,7 +101,11 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) if (distance_squared > dist_near_chat * dist_near_chat) { // diminish far-off chat - r_color.mV[VALPHA] = 0.8f; + r_color_alpha = 0.8f; + } + else + { + r_color_alpha = 1.0f; } } } diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h index a84d7dbc5d..6138358caf 100644 --- a/indra/newview/llviewerchat.h +++ b/indra/newview/llviewerchat.h @@ -29,15 +29,14 @@ #include "llchat.h" #include "llfontgl.h" -#include "v4color.h" - +#include "lluicolor.h" class LLViewerChat { public: 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, LLUIColor& r_color, F32& r_color_alpha); static void getChatColor(const LLChat& chat, std::string& r_color_name, F32& r_color_alpha); static LLFontGL* getChatFont(); static S32 getChatFontSize(); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index c97a512a57..9bdd246129 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -134,6 +134,7 @@ #include "llfloaterscriptlimits.h" #include "llfloatersearch.h" #include "llfloatersellland.h" +#include "llfloatersettingscolor.h" #include "llfloatersettingsdebug.h" #include "llfloatersidepanelcontainer.h" #include "llfloatersnapshot.h" @@ -486,6 +487,7 @@ void LLViewerFloaterReg::registerFloaters() 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_color", "floater_settings_color.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsColor>); 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>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index cd0b3dbd0c..e3b92598f7 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -536,9 +536,7 @@ void init_menus() /// /// set up the colors /// - LLColor4 color; - - LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor"); + LLUIColor context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor"); gMenuAvatarSelf->setBackgroundColor( context_menu_color ); gMenuAvatarOther->setBackgroundColor( context_menu_color ); @@ -548,7 +546,7 @@ void init_menus() gMenuLand->setBackgroundColor( context_menu_color ); - color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" ); + LLUIColor color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" ); gPopupMenuView->setBackgroundColor( color ); // If we are not in production, use a different color to make it apparent. @@ -1892,10 +1890,9 @@ class LLAdvancedForceParamsToDefault : public view_listener_t 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) + for (LLCharacter* character : LLCharacter::sInstances) { - (*iter)->setAnimTimeFactor(time_factor); + character->setAnimTimeFactor(time_factor); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 8679260a21..4558c156fb 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1521,7 +1521,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, S32 size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ExtraParams); if (size > 0) { - U8 *buffer = new U8[size]; + U8 *buffer = new(std::nothrow) U8[size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer, size: " << size << LL_ENDL; + } mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ExtraParams, buffer, size, block_num); LLDataPackerBinaryBuffer dp(buffer, size); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 08c81c4b6c..09f813accc 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -266,7 +266,11 @@ public: virtual bool isRiggedMesh() const { return false; } virtual bool hasLightTexture() const { return false; } virtual bool isReflectionProbe() const { return false; } + virtual F32 getReflectionProbeAmbiance() const { return 0.f; } + virtual F32 getReflectionProbeNearClip() const { return 0.f; } virtual bool getReflectionProbeIsBox() const { return false; } + virtual bool getReflectionProbeIsDynamic() const { return false; }; + virtual bool getReflectionProbeIsMirror() 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 diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index cda8c99594..ae64ee7b92 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1715,15 +1715,15 @@ void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp) 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 = + static const LLUIColor above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" ); + static const LLUIColor below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" ); + static const LLUIColor you_own_above_water_color = LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" ); - LLColor4 you_own_below_water_color = + static const LLUIColor you_own_below_water_color = LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" ); - LLColor4 group_own_above_water_color = + static const LLUIColor group_own_above_water_color = LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" ); - LLColor4 group_own_below_water_color = + static const LLUIColor group_own_below_water_color = LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" ); F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius"); @@ -1753,7 +1753,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) // See DEV-17370 and DEV-29869/SNOW-79 for details. approx_radius = llmin(approx_radius, max_radius); - LLColor4U color = above_water_color; + LLColor4U color = above_water_color.get(); if( objectp->permYouOwner() ) { const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f; @@ -1766,29 +1766,29 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { if ( objectp->permGroupOwner() ) { - color = group_own_above_water_color; + color = group_own_above_water_color.get(); } else { - color = you_own_above_water_color; + color = you_own_above_water_color.get(); } } else { if ( objectp->permGroupOwner() ) { - color = group_own_below_water_color; + color = group_own_below_water_color.get(); } else { - color = you_own_below_water_color; + color = you_own_below_water_color.get(); } } } else if( pos.mdV[VZ] < water_height ) { - color = below_water_color; + color = below_water_color.get(); } netmap.renderScaledPointGlobal( diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 58b8a5b677..2e9b5de72b 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -53,6 +53,14 @@ static const U8 OVERLAY_IMG_COMPONENTS = 4; static const F32 LINE_WIDTH = 0.0625f; +bool LLViewerParcelOverlay::sColorSetInitialized = false; +LLUIColor LLViewerParcelOverlay::sAvailColor; +LLUIColor LLViewerParcelOverlay::sOwnedColor; +LLUIColor LLViewerParcelOverlay::sGroupColor; +LLUIColor LLViewerParcelOverlay::sSelfColor; +LLUIColor LLViewerParcelOverlay::sForSaleColor; +LLUIColor LLViewerParcelOverlay::sAuctionColor; + LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) : mRegion( region ), mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), @@ -60,6 +68,17 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_ mTimeSinceLastUpdate(), mOverlayTextureIdx(-1) { + if (!sColorSetInitialized) + { + sColorSetInitialized = true; + sAvailColor = LLUIColorTable::instance().getColor("PropertyColorAvail").get(); + sOwnedColor = LLUIColorTable::instance().getColor("PropertyColorOther").get(); + sGroupColor = LLUIColorTable::instance().getColor("PropertyColorGroup").get(); + sSelfColor = LLUIColorTable::instance().getColor("PropertyColorSelf").get(); + sForSaleColor = LLUIColorTable::instance().getColor("PropertyColorForSale").get(); + sAuctionColor = LLUIColorTable::instance().getColor("PropertyColorAuction").get(); + } + // Create a texture to hold color information. // 4 components // Use mipmaps = false, clamped, NEAREST filter, for sharp edges @@ -321,12 +340,12 @@ void LLViewerParcelOverlay::updateOverlayTexture() mOverlayTextureIdx = 0; } - 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(); + const LLColor4U avail = sAvailColor.get(); + const LLColor4U owned = sOwnedColor.get(); + const LLColor4U group = sGroupColor.get(); + const LLColor4U self = sSelfColor.get(); + const LLColor4U for_sale = sForSaleColor.get(); + const LLColor4U auction = sAuctionColor.get(); // Create the base texture. U8 *raw = mImageRaw->getData(); @@ -339,7 +358,7 @@ void LLViewerParcelOverlay::updateOverlayTexture() { U8 ownership = mOwnership[i]; - F32 r,g,b,a; + U8 r,g,b,a; // Color stored in low three bits switch( ownership & 0x7 ) @@ -433,11 +452,11 @@ void LLViewerParcelOverlay::updatePropertyLines() return; LLColor4U colors[PARCEL_COLOR_MASK + 1]; - colors[PARCEL_SELF] = LLUIColorTable::instance().getColor("PropertyColorSelf").get(); - colors[PARCEL_OWNED] = LLUIColorTable::instance().getColor("PropertyColorOther").get(); - colors[PARCEL_GROUP] = LLUIColorTable::instance().getColor("PropertyColorGroup").get(); - colors[PARCEL_FOR_SALE] = LLUIColorTable::instance().getColor("PropertyColorForSale").get(); - colors[PARCEL_AUCTION] = LLUIColorTable::instance().getColor("PropertyColorAuction").get(); + colors[PARCEL_SELF] = sSelfColor.get(); + colors[PARCEL_OWNED] = sOwnedColor.get(); + colors[PARCEL_GROUP] = sGroupColor.get(); + colors[PARCEL_FOR_SALE] = sForSaleColor.get(); + colors[PARCEL_AUCTION] = sAuctionColor.get(); mEdges.clear(); diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index d78005e376..03ae464cb8 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -35,6 +35,7 @@ #include "lluuid.h" #include "llviewertexture.h" #include "llgl.h" +#include "lluicolor.h" class LLViewerRegion; class LLVector3; @@ -123,6 +124,14 @@ private: }; std::vector<Edge> mEdges; + + static bool sColorSetInitialized; + static LLUIColor sAvailColor; + static LLUIColor sOwnedColor; + static LLUIColor sGroupColor; + static LLUIColor sSelfColor; + static LLUIColor sForSaleColor; + static LLUIColor sAuctionColor; }; #endif diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 15902e8a87..14228b469f 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -222,15 +222,9 @@ public: image_rect.mTop = image_rect.mBottom + mImage->getHeight(); mImage->draw(LLRect((S32)image_rect.mLeft, (S32)image_rect.mTop, (S32)image_rect.mRight, (S32)image_rect.mBottom)); - LLColor4 color; - if (mEditor.getReadOnly()) - { - color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor"); - } - else - { - color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor"); - } + static const LLUIColor embedded_item_readonly_col = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor"); + static const LLUIColor embedded_item_col = LLUIColorTable::instance().getColor("TextEmbeddedItemColor"); + const LLColor4& color = mEditor.getReadOnly() ? embedded_item_readonly_col : embedded_item_col; 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, static_cast<S32>(mLabel.length()), S32_MAX, &right_x); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9648a9af18..8faa86876f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -539,9 +539,9 @@ void LLViewerTexture::updateClass() LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL; sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f); - for (auto image : gTextureList) + for (auto& image : gTextureList) { - gTextureList.updateImageDecodePriority(image); + gTextureList.updateImageDecodePriority(image, false /*will modify gTextureList otherwise!*/); } } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index d31c53d000..865805f9bf 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -904,7 +904,7 @@ void LLViewerTextureList::clearFetchingRequests() extern bool gCubeSnapshot; -void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imagep) +void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imagep, bool flush_images) { if (imagep->isInDebug() || imagep->isUnremovable()) { @@ -948,7 +948,9 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag // shows one letter at a time // // Maximum usage examples: huge chunk of terrain repeats texture - const LLTextureEntry* te = face->getTextureEntry(); + S32 te_offset = face->getTEOffset(); // offset is -1 if not inited + LLViewerObject* objp = face->getViewerObject(); + const LLTextureEntry* te = (te_offset < 0 || te_offset >= objp->getNumTEs()) ? nullptr : objp->getTE(te_offset); F32 min_scale = te ? llmin(fabsf(te->getScaleS()), fabsf(te->getScaleT())) : 1.f; min_scale = llclamp(min_scale * min_scale, texture_scale_min(), texture_scale_max()); vsize /= min_scale; @@ -991,7 +993,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag // Flush formatted images using a lazy flush // S32 num_refs = imagep->getNumRefs(); - if (num_refs == min_refs) + if (num_refs == min_refs && flush_images) { if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > lazy_flush_timeout) { diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 075f6ae915..b614753b4f 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -148,7 +148,7 @@ public: // - updates decode priority // - updates desired discard level // - cleans up textures that haven't been referenced in awhile - void updateImageDecodePriority(LLViewerFetchedTexture* imagep); + void updateImageDecodePriority(LLViewerFetchedTexture* imagep, bool flush_images = true); private: F32 updateImagesCreateTextures(F32 max_time); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 9dc12c4856..417cece8eb 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -741,18 +741,16 @@ public: 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 + for (LLCharacter* character : LLCharacter::sInstances) { - // Stuff into a sorted map so the display is ordered - sorted_avs[avatar->getFullname()] = avatar; + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!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; @@ -2192,7 +2190,7 @@ void LLViewerWindow::initWorldUI() 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()); + gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor()); // 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); @@ -2201,7 +2199,7 @@ void LLViewerWindow::initWorldUI() LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container"); navbar->setShape(nav_bar_container->getLocalRect()); - navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + navbar->setBackgroundColor(gMenuBarView->getBackgroundColor()); nav_bar_container->addChild(navbar); nav_bar_container->setVisible(true); } @@ -2585,7 +2583,7 @@ void LLViewerWindow::setNormalControlsVisible( bool visible ) void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) { LLSD args; - LLColor4 new_bg_color; + LLUIColor new_bg_color; // god more important than project, proj more important than grid if ( god_mode ) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fcd2f74108..d5a8ee6cf8 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -768,6 +768,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, } mVisuallyMuteSetting = LLVOAvatar::VisualMuteSettings(LLRenderMuteList::getInstance()->getSavedVisualMuteSetting(getID())); + + sInstances.push_back(this); } std::string LLVOAvatar::avString() const @@ -815,6 +817,8 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c //------------------------------------------------------------------------ LLVOAvatar::~LLVOAvatar() { + sInstances.remove(this); + if (!mFullyLoaded) { debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud"); @@ -957,26 +961,16 @@ void LLVOAvatar::deleteLayerSetCaches(bool clearAll) // 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) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*) *iter; - if( inst->isDead() ) - { - continue; - } - else if( !inst->isFullyBaked() ) + LLVOAvatar* inst = (LLVOAvatar*)character; + if (!inst->isDead() && inst->mHasGrey && !inst->isFullyBaked()) { - res = false; - if (inst->mHasGrey) - { - ++grey_avatars; - } + ++grey_avatars; } } - return res; + return !grey_avatars; } // static @@ -987,11 +981,10 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_t avg_cloud_time = 0; cloud_avatars = 0; S32 count_avg = 0; - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*) *iter; - if (inst) + if (LLVOAvatar* inst = (LLVOAvatar*)character) { S32 rez_status = inst->getRezzedStatus(); counts[rez_status]++; @@ -1008,6 +1001,7 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_t } } } + if (count_avg > 0) { avg_cloud_time /= count_avg; @@ -1017,11 +1011,19 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_t // 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 baked"; - if (rez_status==3) return "loading attachments"; - if (rez_status==4) return "full"; + switch (rez_status) + { + case 0: + return "cloud"; + case 1: + return "gray"; + case 2: + return "downloading baked"; + case 3: + return "loading attachments"; + case 4: + return "full"; + } return "unknown"; } @@ -1030,10 +1032,9 @@ void LLVOAvatar::dumpBakedStatus() { LLVector3d camera_pos_global = gAgentCamera.getCameraPositionGlobal(); - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*) *iter; + LLVOAvatar* inst = (LLVOAvatar*)character; LL_INFOS() << "Avatar "; LLNameValue* firstname = inst->getNVPair("FirstName"); @@ -1128,10 +1129,9 @@ void LLVOAvatar::destroyGL() //static void LLVOAvatar::resetImpostors() { - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* avatar = (LLVOAvatar*) *iter; + LLVOAvatar* avatar = (LLVOAvatar*)character; avatar->mImpostor.release(); avatar->mNeedsImpostorUpdate = true; avatar->mLastImpostorUpdateReason = 1; @@ -1143,11 +1143,9 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) { if (LLViewerTexLayerSet::sHasCaches) { - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*) *iter; - inst->deleteLayerSetCaches(clearAll); + ((LLVOAvatar*)character)->deleteLayerSetCaches(clearAll); } LLViewerTexLayerSet::sHasCaches = false; } @@ -1202,7 +1200,7 @@ void LLVOAvatar::initInstance() //------------------------------------------------------------------------- if (LLCharacter::sInstances.size() == 1) { - registerMotion( ANIM_AGENT_DO_NOT_DISTURB, LLNullMotion::create ); + 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 ); @@ -2820,7 +2818,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled, const LLVector3 & // 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 (LLVoiceClient::getInstance()->getIsSpeaking( mID ) && (!isInMuteList() || isSelf())) { if (!mVoiceVisualizer->getCurrentlySpeaking()) { @@ -3147,7 +3145,7 @@ void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) void LLVOAvatar::idleUpdateLoadingEffect() { // update visibility when avatar is partially loaded - if (updateIsFullyLoaded()) // changed? + if (!mFullyLoaded && updateIsFullyLoaded()) // Avoid repeat calculations by checking if mFullyLoaded is true first. { if (isFullyLoaded()) { @@ -3397,7 +3395,7 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) { is_muted = isInMuteList(); } - bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); + bool is_friend = isBuddy(); bool is_cloud = getIsCloud(); if (is_appearance != mNameAppearance) @@ -3533,7 +3531,9 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) std::deque<LLChat>::iterator chat_iter = mChats.begin(); mNameText->clearString(); - LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); + static const LLUIColor user_chat_color = LLUIColorTable::instance().getColor("UserChatColor"); + static const LLUIColor agent_chat_color = LLUIColorTable::instance().getColor("AgentChatColor"); + const LLColor4& new_chat = isSelf() ? user_chat_color : agent_chat_color; 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) @@ -3628,29 +3628,28 @@ void LLVOAvatar::clearNameTag() mTimeVisible.reset(); } -//static +// static void LLVOAvatar::invalidateNameTag(const LLUUID& agent_id) { - LLViewerObject* obj = gObjectList.findObject(agent_id); - if (!obj) return; - - LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(obj); - if (!avatar) return; - - avatar->clearNameTag(); + if (LLViewerObject* obj = gObjectList.findObject(agent_id)) + { + if (LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(obj)) + { + avatar->clearNameTag(); + } + } } -//static +// static void LLVOAvatar::invalidateNameTags() { - std::vector<LLCharacter*>::iterator it = LLCharacter::sInstances.begin(); - for ( ; it != LLCharacter::sInstances.end(); ++it) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*it); - if (!avatar) continue; - if (avatar->isDead()) continue; - - avatar->clearNameTag(); + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isDead()) + { + avatar->clearNameTag(); + } } } @@ -8261,15 +8260,13 @@ void LLVOAvatar::logPendingPhases() //static void LLVOAvatar::logPendingPhasesAllAvatars() { - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*) *iter; - if( inst->isDead() ) + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isDead()) { - continue; + avatar->logPendingPhases(); } - inst->logPendingPhases(); } } @@ -8457,7 +8454,7 @@ bool LLVOAvatar::isTooComplex() const { bool too_complex; static LLCachedControl<S32> compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); - bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY); + bool render_friend = (isBuddy() && compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY); if (isSelf() || render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) { @@ -8493,7 +8490,7 @@ bool LLVOAvatar::isTooSlow() const static LLCachedControl<S32> compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); - bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); + bool is_friend = isBuddy(); bool render_friend = is_friend && compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; if (render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) @@ -8550,7 +8547,7 @@ void LLVOAvatar::updateTooSlow() if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap { bool always_render_friends = compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; - bool render_friend_or_exception = (always_render_friends && LLAvatarTracker::instance().isBuddy( id ) ) || + bool render_friend_or_exception = (always_render_friends && isBuddy()) || ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER ); if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception) { @@ -10443,15 +10440,16 @@ void LLVOAvatar::setVisibilityRank(U32 rank) S32 LLVOAvatar::getUnbakedPixelAreaRank() { S32 rank = 1; - for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*) *iter; - if (inst == this) + if (character == this) { return rank; } - else if (!inst->isDead() && !inst->isFullyBaked()) + + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isDead() && !avatar->isFullyBaked()) { rank++; } @@ -10461,49 +10459,37 @@ S32 LLVOAvatar::getUnbakedPixelAreaRank() return 0; } -struct CompareScreenAreaGreater -{ - 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()); + LLCharacter::sInstances.sort([](LLCharacter* lhs, LLCharacter* rhs) + { + return lhs->getPixelArea() > rhs->getPixelArea(); + }); // 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()) + U32 rank = 2; //1 is reserved for self. + for (LLCharacter* character : LLCharacter::sInstances) { - culled = false; - } - else - { - culled = true; - } + LLVOAvatar* inst = (LLVOAvatar*)character; + bool culled = !inst->isSelf() && !inst->isFullyBaked(); - if (inst->mCulled != culled) - { - inst->mCulled = culled; - LL_DEBUGS() << "avatar " << inst->getID() << (culled ? " start culled" : " start not culled" ) << LL_ENDL; - inst->updateMeshTextures(); - } + 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++); + if (inst->isSelf()) + { + inst->setVisibilityRank(1); + } + else if (inst->mDrawable.notNull() && inst->mDrawable->isVisible()) + { + inst->setVisibilityRank(rank++); + } } } @@ -10762,11 +10748,9 @@ void LLVOAvatar::updateImpostors() { 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) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* avatar = (LLVOAvatar*) *iter; + LLVOAvatar* avatar = (LLVOAvatar*)character; if (!avatar->isDead() && avatar->isVisible() && avatar->isImpostor() @@ -10923,21 +10907,17 @@ void LLVOAvatar::updateNearbyAvatarCount() S32 avs_nearby = 0; static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64); F32 radius = render_far_clip * render_far_clip; - std::vector<LLCharacter *>::iterator char_iter = LLCharacter::sInstances.begin(); - while (char_iter != LLCharacter::sInstances.end()) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar *avatar = dynamic_cast<LLVOAvatar *>(*char_iter); - if (avatar && !avatar->isDead() && !avatar->isControlAvatar()) + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isDead() && !avatar->isControlAvatar()) { - if ((dist_vec_squared(avatar->getPositionGlobal(), gAgent.getPositionGlobal()) > radius) && - (dist_vec_squared(avatar->getPositionGlobal(), gAgentCamera.getCameraPositionGlobal()) > radius)) + if ((dist_vec_squared(avatar->getPositionGlobal(), gAgent.getPositionGlobal()) <= radius) || + (dist_vec_squared(avatar->getPositionGlobal(), gAgentCamera.getCameraPositionGlobal()) <= radius)) { - char_iter++; - continue; + avs_nearby++; } - avs_nearby++; } - char_iter++; } sAvatarsNearby = avs_nearby; agent_update_timer.reset(); @@ -11511,7 +11491,7 @@ void LLVOAvatar::calcMutedAVColor() new_color = LLColor4::grey4; change_msg = " not rendered: color is grey4"; } - else if (LLMuteList::getInstance()->isMuted(av_id)) // the user blocked them + else if (isInMuteList()) // the user blocked them { // blocked avatars are dark grey new_color = LLColor4::grey4; @@ -11710,10 +11690,9 @@ F32 LLVOAvatar::getTotalGPURenderTime() F32 ret = 0.f; - for (LLCharacter* iter : LLCharacter::sInstances) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*) iter; - ret += inst->getGPURenderTime(); + ret += ((LLVOAvatar*)character)->getGPURenderTime(); } return ret; @@ -11725,10 +11704,9 @@ F32 LLVOAvatar::getMaxGPURenderTime() F32 ret = 0.f; - for (LLCharacter* iter : LLCharacter::sInstances) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*)iter; - ret = llmax(inst->getGPURenderTime(), ret); + ret = llmax(((LLVOAvatar*)character)->getGPURenderTime(), ret); } return ret; @@ -11742,12 +11720,12 @@ F32 LLVOAvatar::getAverageGPURenderTime() S32 count = 0; - for (LLCharacter* iter : LLCharacter::sInstances) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* inst = (LLVOAvatar*)iter; - if (!inst->isTooSlow()) + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isTooSlow()) { - ret += inst->getGPURenderTime(); + ret += avatar->getGPURenderTime(); ++count; } } @@ -11759,8 +11737,23 @@ F32 LLVOAvatar::getAverageGPURenderTime() return ret; } + bool LLVOAvatar::isBuddy() const { - return LLAvatarTracker::instance().isBuddy(getID()); + bool is_friend = false; + F64 now = LLFrameTimer::getTotalSeconds(); + if (now < mCachedBuddyListUpdateTime) + { + is_friend = mCachedInBuddyList; + } + else + { + is_friend = LLAvatarTracker::instance().isBuddy(getID()); + + const F64 SECONDS_BETWEEN_BUDDY_UPDATES = 1; + mCachedBuddyListUpdateTime = now + SECONDS_BETWEEN_BUDDY_UPDATES; + mCachedInBuddyList = is_friend; + } + return is_friend; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1ca8b81553..2144be1ba5 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -587,6 +587,8 @@ private: mutable bool mCachedInMuteList; mutable F64 mCachedMuteListUpdateTime; + mutable bool mCachedInBuddyList = false; + mutable F64 mCachedBuddyListUpdateTime = 0.0; VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index b95e43da8d..912b5a330e 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -768,6 +768,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID &session_id, mReceivedCall(false), mOutgoingCallInterface(outgoing_call_interface) { + mChannelInfo = LLVoiceClient::getInstance()->getP2PChannelInfoTemplate(other_user_id); } void LLVoiceChannelP2P::handleStatusChange(EStatusType type) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 4b299a51f5..264e11fe34 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -826,7 +826,7 @@ void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } -std::string LLVoiceClient::sipURIFromID(const LLUUID &id) +std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const { if (mNonSpatialVoiceModule) { @@ -842,6 +842,22 @@ std::string LLVoiceClient::sipURIFromID(const LLUUID &id) } } +LLSD LLVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const +{ + if (mNonSpatialVoiceModule) + { + return mNonSpatialVoiceModule->getP2PChannelInfoTemplate(id); + } + else if (mSpatialVoiceModule) + { + return mSpatialVoiceModule->getP2PChannelInfoTemplate(id); + } + else + { + return LLSD(); + } +} + LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const { return NULL; diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 9ae18b315c..ea67500109 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -281,7 +281,8 @@ public: virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0; //@} - virtual std::string sipURIFromID(const LLUUID &id)=0; + virtual std::string sipURIFromID(const LLUUID &id) const=0; + virtual LLSD getP2PChannelInfoTemplate(const LLUUID& id) const=0; //@} }; @@ -488,7 +489,8 @@ public: void addObserver(LLVoiceClientParticipantObserver* observer); void removeObserver(LLVoiceClientParticipantObserver* observer); - std::string sipURIFromID(const LLUUID &id); + std::string sipURIFromID(const LLUUID &id) const; + LLSD getP2PChannelInfoTemplate(const LLUUID& id) const; ////////////////////////// /// @name Voice effects diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6e301740a0..7b19ec5fd7 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -298,7 +298,6 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : mDevicesListUpdated(false), mAudioSession(), // TBD - should be NULL - mAudioSessionChanged(false), mNextAudioSession(), mCurrentParcelLocalID(0), @@ -1644,7 +1643,6 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession) LL_INFOS("Voice") << "Adding or joining voice session " << nextSession->mHandle << LL_ENDL; mAudioSession = nextSession; - mAudioSessionChanged = true; if (!mAudioSession || !mAudioSession->mReconnect) { mNextAudioSession.reset(); @@ -1901,9 +1899,8 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) sessionStatePtr_t oldSession = mAudioSession; + notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); // needs mAudioSession for uri mAudioSession.reset(); - // We just notified status observers about this change. Don't do it again. - mAudioSessionChanged = false; // The old session may now need to be deleted. reapSession(oldSession); @@ -1911,9 +1908,9 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) else { LL_WARNS("Voice") << "terminateAudioSession(" << wait << ") with NULL mAudioSession" << LL_ENDL; + notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); } - 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 @@ -3835,7 +3832,6 @@ void LLVivoxVoiceClient::joinedAudioSession(const sessionStatePtr_t &session) sessionStatePtr_t oldSession = mAudioSession; mAudioSession = session; - mAudioSessionChanged = true; // The old session may now need to be deleted. reapSession(oldSession); @@ -5145,7 +5141,7 @@ bool LLVivoxVoiceClient::inProximalChannel() return result; } -std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id) +std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id) const { std::string result; result = "sip:"; @@ -5156,6 +5152,14 @@ std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id) return result; } +LLSD LLVivoxVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const +{ + LLSD result; + result["channel_uri"] = sipURIFromID(id); + result["voice_server_type"] = VIVOX_VOICE_SERVER_TYPE; + return result; +} + std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar) { std::string result; @@ -5170,7 +5174,7 @@ std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar) return result; } -std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid) +std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid) const { std::string result; @@ -6150,7 +6154,6 @@ void LLVivoxVoiceClient::deleteSession(const sessionStatePtr_t &session) if(mAudioSession == session) { mAudioSession.reset(); - mAudioSessionChanged = true; } // ditto for the next audio session @@ -6259,9 +6262,10 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta } } + LLSD channel_info = getAudioSessionChannelInfo(); LL_DEBUGS("Voice") << " " << LLVoiceClientStatusObserver::status2string(status) - << ", session channelInfo " << getAudioSessionChannelInfo() + << ", session channelInfo " << channel_info << ", proximal is " << inSpatialChannel() << LL_ENDL; @@ -6276,7 +6280,7 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta ) { LLVoiceClientStatusObserver* observer = *it; - observer->onChange(status, getAudioSessionChannelInfo(), inSpatialChannel()); + observer->onChange(status, channel_info, inSpatialChannel()); // In case onError() deleted an entry. it = mStatusObservers.upper_bound(observer); } diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 420e0aa869..b0ce5df93c 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -221,7 +221,8 @@ public: void removeObserver(LLVoiceClientParticipantObserver* observer) override; //@} - std::string sipURIFromID(const LLUUID &id) override; + std::string sipURIFromID(const LLUUID &id) const override; + LLSD getP2PChannelInfoTemplate(const LLUUID& id) const override; //@} /// @name LLVoiceEffectInterface virtual implementations @@ -706,7 +707,6 @@ private: std::string mChannelName; // Name of the channel to be looked up 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 @@ -748,7 +748,7 @@ private: 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 nameFromID(const LLUUID &id); + std::string nameFromID(const LLUUID &id) const; bool IDFromName(const std::string name, LLUUID &uuid); std::string sipURIFromAvatar(LLVOAvatar *avatar); std::string sipURIFromName(std::string &name); diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index bd0b0eaff3..7a728d9164 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -248,7 +248,7 @@ LLWebRTCVoiceClient::~LLWebRTCVoiceClient() void LLWebRTCVoiceClient::init(LLPumpIO* pump) { // constructor will set up LLVoiceClient::getInstance() - llwebrtc::init(); + llwebrtc::init(this); mWebRTCDeviceInterface = llwebrtc::getDeviceInterface(); mWebRTCDeviceInterface->setDevicesObserver(this); @@ -279,6 +279,29 @@ void LLWebRTCVoiceClient::cleanUp() LL_DEBUGS("Voice") << "Exiting" << LL_ENDL; } +void LLWebRTCVoiceClient::LogMessage(llwebrtc::LLWebRTCLogCallback::LogLevel level, const std::string& message) +{ + switch (level) + { + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_VERBOSE: + LL_DEBUGS("Voice") << message << LL_ENDL; + break; + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_INFO: + LL_INFOS("Voice") << message << LL_ENDL; + break; + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_WARNING: + LL_WARNS("Voice") << message << LL_ENDL; + break; + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_ERROR: + // use WARN so that we don't crash on a webrtc error. + // webrtc will force a crash on a fatal error. + LL_WARNS("Voice") << message << LL_ENDL; + break; + default: + break; + } +} + // -------------------------------------------------- const LLVoiceVersionInfo& LLWebRTCVoiceClient::getVersion() @@ -2067,11 +2090,16 @@ void LLWebRTCVoiceClient::avatarNameResolved(const LLUUID &id, const std::string } // Leftover from vivox PTSN -std::string LLWebRTCVoiceClient::sipURIFromID(const LLUUID& id) +std::string LLWebRTCVoiceClient::sipURIFromID(const LLUUID& id) const { return id.asString(); } +LLSD LLWebRTCVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const +{ + return LLSD(); +} + ///////////////////////////// // LLVoiceWebRTCConnection diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 480a7897cd..2b9a113fcc 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -62,7 +62,8 @@ extern const std::string WEBRTC_VOICE_SERVER_TYPE; class LLWebRTCVoiceClient : public LLSingleton<LLWebRTCVoiceClient>, virtual public LLVoiceModuleInterface, public llwebrtc::LLWebRTCDevicesObserver, - public LLMuteListObserver + public LLMuteListObserver, + public llwebrtc::LLWebRTCLogCallback { LLSINGLETON(LLWebRTCVoiceClient); LOG_CLASS(LLWebRTCVoiceClient); @@ -84,7 +85,15 @@ public: // Returns true if WebRTC has successfully logged in and is not in error state bool isVoiceWorking() const override; - std::string sipURIFromID(const LLUUID &id) override; + std::string sipURIFromID(const LLUUID &id) const override; + LLSD getP2PChannelInfoTemplate(const LLUUID& id) const override; + + + /////////////////// + /// @name Logging + /// @{ + void LogMessage(llwebrtc::LLWebRTCLogCallback::LogLevel level, const std::string& message) override; + //@} ///////////////////// /// @name Tuning diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 471174cf5d..d7fe17c3ce 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -987,7 +987,7 @@ LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp) } // Do not add vertices; honor strict vertex count specified by strider_vertex_count -void gen_terrain_tangents(U16 strider_vertex_count, +void gen_terrain_tangents(U32 strider_vertex_count, U32 strider_index_count, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, @@ -1003,7 +1003,7 @@ void gen_terrain_tangents(U16 strider_vertex_count, std::vector<LLVector2> texcoords(strider_vertex_count); std::vector<U16> indices(strider_index_count); - for (U16 v = 0; v < strider_vertex_count; ++v) + for (U32 v = 0; v < strider_vertex_count; ++v) { F32 *vert = verticesp[v].mV; vertices[v] = LLVector4a(vert[0], vert[1], vert[2], 1.f); @@ -1019,7 +1019,7 @@ void gen_terrain_tangents(U16 strider_vertex_count, LLCalculateTangentArray(strider_vertex_count, vertices, normals, texcoords.data(), strider_index_count / 3, indices.data(), tangents); - for (U16 v = 0; v < strider_vertex_count; ++v) + for (U32 v = 0; v < strider_vertex_count; ++v) { tangentsp[v] = tangents[v]; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e7919e8970..db8d9af774 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5646,7 +5646,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } // HACK -- brute force this check every time a drawable gets rebuilt - for (S32 i = 0; i < drawablep->getNumFaces(); ++i) + S32 num_tex = llmin(vobj->getNumTEs(), drawablep->getNumFaces()); + for (S32 i = 0; i < num_tex; ++i) { vobj->updateTEMaterialTextures(i); } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 07e02e042c..6241bf42d6 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -304,11 +304,11 @@ public: bool setReflectionProbeIsMirror(bool is_mirror); bool isReflectionProbe() const override; - F32 getReflectionProbeAmbiance() const; - F32 getReflectionProbeNearClip() const; + F32 getReflectionProbeAmbiance() const override; + F32 getReflectionProbeNearClip() const override; bool getReflectionProbeIsBox() const override; - bool getReflectionProbeIsDynamic() const; - bool getReflectionProbeIsMirror() const; + bool getReflectionProbeIsDynamic() const override; + bool getReflectionProbeIsMirror() const override; // Flexible Objects U32 getVolumeInterfaceID() const; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 9508d33eb3..40bfa8ec83 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1320,35 +1320,32 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi } // 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) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; - - if (!pVOAvatar->isDead() && !pVOAvatar->mIsDummy && !pVOAvatar->isOrphaned()) + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isDead() && !avatar->mIsDummy && !avatar->isOrphaned()) { - LLVector3d pos_global = pVOAvatar->getPositionGlobal(); - LLUUID uuid = pVOAvatar->getID(); + LLVector3d pos_global = avatar->getPositionGlobal(); + LLUUID uuid = avatar->getID(); if (!uuid.isNull() && dist_vec_squared(pos_global, relative_to) <= radius_squared) { - if(positions != NULL) + if (positions != NULL) { positions->push_back(pos_global); } - if(avatar_ids !=NULL) + 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) + for (const LLViewerRegion* regionp : LLWorld::getInstance()->getRegionList()) { - LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); auto count = regionp->mMapAvatars.size(); for (size_t i = 0; i < count; i++) @@ -1371,33 +1368,31 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi } } -F32 LLWorld::getNearbyAvatarsAndMaxGPUTime(std::vector<LLCharacter*> &valid_nearby_avs) +F32 LLWorld::getNearbyAvatarsAndMaxGPUTime(std::vector<LLVOAvatar*> &valid_nearby_avs) { static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64); + F32 nearby_max_complexity = 0; F32 radius = render_far_clip * render_far_clip; - std::vector<LLCharacter*>::iterator char_iter = LLCharacter::sInstances.begin(); - while (char_iter != LLCharacter::sInstances.end()) + + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*char_iter); - if (avatar && !avatar->isDead() && !avatar->isControlAvatar()) + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (!avatar->isDead() && !avatar->isControlAvatar()) { - if ((dist_vec_squared(avatar->getPositionGlobal(), gAgent.getPositionGlobal()) > radius) && - (dist_vec_squared(avatar->getPositionGlobal(), gAgentCamera.getCameraPositionGlobal()) > radius)) + if ((dist_vec_squared(avatar->getPositionGlobal(), gAgent.getPositionGlobal()) <= radius) || + (dist_vec_squared(avatar->getPositionGlobal(), gAgentCamera.getCameraPositionGlobal()) <= radius)) { - char_iter++; - continue; - } - - if (!avatar->isTooSlow()) - { - gPipeline.profileAvatar(avatar); + if (!avatar->isTooSlow()) + { + gPipeline.profileAvatar(avatar); + } + nearby_max_complexity = llmax(nearby_max_complexity, avatar->getGPURenderTime()); + valid_nearby_avs.push_back(avatar); } - nearby_max_complexity = llmax(nearby_max_complexity, avatar->getGPURenderTime()); - valid_nearby_avs.push_back(*char_iter); } - char_iter++; } + return nearby_max_complexity; } diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 01f666d19a..dc95a4eff1 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -172,7 +172,7 @@ public: // profile nearby avatars using gPipeline.profileAvatar and update their render times // return max GPU time - F32 getNearbyAvatarsAndMaxGPUTime(std::vector<LLCharacter*> &valid_nearby_avs); + F32 getNearbyAvatarsAndMaxGPUTime(std::vector<LLVOAvatar*> &valid_nearby_avs); private: void clearHoleWaterObjects(); diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index fb9d140851..aab19a4d5f 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -128,9 +128,9 @@ public: 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); } + bool isDown() const { return (mAccess == SIM_ACCESS_DOWN); } + bool isPG() const { return (mAccess <= SIM_ACCESS_PG); } + bool isAdult() const { return (mAccess == SIM_ACCESS_ADULT); } // Debug only void dump() const; // Print the region info to the standard output @@ -157,6 +157,8 @@ public: const LLSimInfo::item_info_list_t& getLandForSaleAdult() const { return mLandForSaleAdult; } const LLSimInfo::item_info_list_t& getAgentLocation() const { return mAgentLocations; } + const U64& getHandle() const { return mHandle; } + 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 diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 056affb68e..2a461ca84b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6438,16 +6438,14 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start, } } - //check all avatar nametags (silly, isn't it?) - for (std::vector< LLCharacter* >::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); - ++iter) + // check all avatar nametags (silly, isn't it?) + for (LLCharacter* character : LLCharacter::sInstances) { - LLVOAvatar* av = (LLVOAvatar*) *iter; - if (av->mNameText.notNull() - && av->mNameText->lineSegmentIntersect(start, local_end, position)) + LLVOAvatar* avatar = (LLVOAvatar*)character; + if (avatar->mNameText.notNull() && + avatar->mNameText->lineSegmentIntersect(start, local_end, position)) { - drawable = av->mDrawable; + drawable = avatar->mDrawable; local_end = position; } } diff --git a/indra/newview/skins/default/xui/en/floater_settings_color.xml b/indra/newview/skins/default/xui/en/floater_settings_color.xml new file mode 100644 index 0000000000..0722677f1d --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_settings_color.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater + legacy_header_height="18" + can_minimize="false" + height="360" + min_height="367" + layout="topleft" + name="settings_color" + help_topic="settings_color" + title="COLOR SETTINGS" + reuse_instance="true" + can_resize="true" + min_width="550" + width="570"> + <filter_editor + follows="left|top|right" + height="23" + layout="topleft" + left="10" + right="-10" + label="Enter search text" + max_length_chars="300" + name="filter_input" + text_pad_left="10" + top="30" /> + <scroll_list + column_padding="0" + draw_heading="true" + draw_stripes="false" + heading_height="23" + height="266" + layout="topleft" + search_column="1" + sort_column="1" + left="10" + follows="left|top|bottom" + name="setting_list" + top_pad="2" + width="300"> + <scroll_list.columns + name="changed_color" + relative_width="0.05" /> + <scroll_list.columns + label="Color" + name="color" /> + </scroll_list> + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + name="color_name_txt" + font="SansSerifSmallBold" + top_delta="8" + left_pad="10" + visible="true" + use_ellipses="true" + text_color="White" + width="240"> + Color name + </text> + <color_swatch + top_pad="0" + left_delta="0" + follows="top|left" + can_apply_immediately="true" + height="180" + name="color_swatch" + visible="true" + layout="topleft" + width="240"> + <color_swatch.commit_callback + function="CommitSettings" /> + </color_swatch> + <spinner + height="20" + label="Alpha" + layout="topleft" + follows="top|left" + left_delta="0" + min_val="0" + max_val="1" + decimal_digits="3" + name="alpha_spinner" + top_pad="5" + visible="true" + width="120"> + <spinner.commit_callback + function="CommitSettings" /> + </spinner> + <button + height="22" + label="Reset to default" + follows="left|top" + layout="topleft" + left_delta="0" + name="default_btn" + visible="true" + top_pad="15" + width="150"> + <button.commit_callback + function="ClickDefault" /> + </button> + <check_box + control_name="ColorSettingsHideDefault" + height="16" + initial_value="true" + label="Show changed colors only" + layout="topleft" + top_pad="10" + left="10" + follows="left|bottom" + name="hide_default" + width="330"> + </check_box> +</floater>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 19d61eb43b..5ab0177de6 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -14,6 +14,9 @@ single_instance="true" title="WORLD MAP" width="650"> + <string name="UnnamedParcel"> + (Unnamed Parcel) + </string> <string name="collapse_icon" value="map_ui_collapse_icon.png"/> diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index a71cbde21b..1d1b81e31a 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -149,6 +149,13 @@ function="Advanced.ShowDebugSettings" parameter="all" /> </menu_item_call> + <menu_item_call + label="Show Color settings" + name="Color Settings"> + <menu_item_call.on_click + function="Floater.Toggle" + parameter="settings_color" /> + </menu_item_call> <menu_item_separator /> <menu_item_call label="XUI Preview Tool" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index e9ce774e8c..0dcd4c8c53 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3830,6 +3830,13 @@ function="World.EnvPreset" name="XUI" tear_off="true"> <menu_item_call + label="Show Color settings" + name="Color Settings"> + <menu_item_call.on_click + function="Floater.Toggle" + parameter="settings_color" /> + </menu_item_call> + <menu_item_call label="Reload Color Settings" name="Reload Color Settings"> <menu_item_call.on_click diff --git a/indra/newview/skins/default/xui/en/panel_region_debug.xml b/indra/newview/skins/default/xui/en/panel_region_debug.xml index 04a510d4e8..be8468a15c 100644 --- a/indra/newview/skins/default/xui/en/panel_region_debug.xml +++ b/indra/newview/skins/default/xui/en/panel_region_debug.xml @@ -140,7 +140,7 @@ layout="topleft" left_delta="0" name="return_other_land" - tool_tip="Return only objects which are on land belonging to someone else" + tool_tip="Return only objects which are on land that isn't owned by selected user" top_delta="20" width="80" /> <check_box diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f9a61ee311..8600efc91e 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -589,9 +589,6 @@ class Windows_x86_64_Manifest(ViewerManifest): # HTTP/2 self.path("nghttp2.dll") - # Hunspell - self.path("libhunspell.dll") - # BugSplat if self.args.get('bugsplat'): self.path("BsSndRpt64.exe") @@ -932,7 +929,6 @@ class Darwin_x86_64_Manifest(ViewerManifest): with self.prefix(src=relpkgdir, dst=""): self.path("libndofdev.dylib") - self.path("libhunspell-*.dylib") with self.prefix(src_dst="cursors_mac"): self.path("*.tif") |