LYN-8403 Prevent the same Surface Tag from getting reused
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>monroegm-disable-blank-issue-2
parent
02b13ca7f1
commit
9aece3e84b
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <EditorSelectableTagListProvider.h>
|
||||
#include <SurfaceData/SurfaceTag.h>
|
||||
|
||||
namespace Terrain
|
||||
{
|
||||
AZStd::vector<AZStd::pair<AZ::u32, AZStd::string>> EditorSelectableTagListProvider::BuildSelectableTagList() const
|
||||
{
|
||||
AZStd::vector<AZStd::pair<AZ::u32, AZStd::string>> availableTags = SurfaceData::SurfaceTag::GetRegisteredTags();
|
||||
|
||||
AZStd::unordered_set<AZ::u32> tagsInUse = AZStd::move(GetSurfaceTagsInUse());
|
||||
|
||||
// Filter out all tags in use from the list of registered tags
|
||||
availableTags.erase(std::remove_if(availableTags.begin(), availableTags.end(),
|
||||
[&tagsInUse](const auto& tag)-> bool
|
||||
{
|
||||
return tagsInUse.contains(tag.first);
|
||||
}), availableTags.end());
|
||||
|
||||
return AZStd::move(availableTags);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/containers/unordered_set.h>
|
||||
|
||||
namespace Terrain
|
||||
{
|
||||
//! Interface for a class providing information about surface tags available for selecting in Editor components.
|
||||
class EditorSelectableTagListProvider
|
||||
{
|
||||
public:
|
||||
//! Returns a list of available tags to be selected in the component.
|
||||
virtual AZStd::vector<AZStd::pair<AZ::u32, AZStd::string>> BuildSelectableTagList() const;
|
||||
|
||||
//! Returns a set of CRC of all surface tags currently in use and not available for selecting.
|
||||
virtual AZStd::unordered_set<AZ::u32> GetSurfaceTagsInUse() const = 0;
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue