Merge branch 'main' into LYN-1932
This commit is contained in:
@@ -26,6 +26,22 @@ namespace Physics
|
||||
->Field("Scale", &ShapeConfiguration::m_scale)
|
||||
;
|
||||
}
|
||||
|
||||
if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
#define REFLECT_SHAPETYPE_ENUM_VALUE(EnumValue) \
|
||||
behaviorContext->EnumProperty<(int)Physics::ShapeType::EnumValue>("ShapeType_"#EnumValue) \
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation) \
|
||||
->Attribute(AZ::Script::Attributes::Module, "physics");
|
||||
|
||||
// Note: Here we only expose the types that are available to the user in the editor
|
||||
REFLECT_SHAPETYPE_ENUM_VALUE(Box);
|
||||
REFLECT_SHAPETYPE_ENUM_VALUE(Sphere);
|
||||
REFLECT_SHAPETYPE_ENUM_VALUE(Cylinder);
|
||||
REFLECT_SHAPETYPE_ENUM_VALUE(PhysicsAsset);
|
||||
|
||||
#undef REFLECT_SHAPETYPE_ENUM_VALUE
|
||||
}
|
||||
}
|
||||
|
||||
void SphereShapeConfiguration::Reflect(AZ::ReflectContext* context)
|
||||
|
||||
@@ -348,6 +348,11 @@ namespace AzToolsFramework
|
||||
*/
|
||||
virtual bool AreAnyEntitiesSelected() = 0;
|
||||
|
||||
/*!
|
||||
* Returns the number of selected entities.
|
||||
*/
|
||||
virtual int GetSelectedEntitiesCount() = 0;
|
||||
|
||||
/*!
|
||||
* Retrieves the set of selected entities.
|
||||
* \return a list of entity Ids.
|
||||
|
||||
@@ -395,6 +395,7 @@ namespace AzToolsFramework
|
||||
->Event("MarkEntityDeselected", &ToolsApplicationRequests::MarkEntityDeselected)
|
||||
->Event("IsSelected", &ToolsApplicationRequests::IsSelected)
|
||||
->Event("AreAnyEntitiesSelected", &ToolsApplicationRequests::AreAnyEntitiesSelected)
|
||||
->Event("GetSelectedEntitiesCount", &ToolsApplicationRequests::GetSelectedEntitiesCount)
|
||||
;
|
||||
|
||||
behaviorContext->EBus<ToolsApplicationNotificationBus>("ToolsApplicationNotificationBus")
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace AzToolsFramework
|
||||
SourceControlFileInfo GetSceneSourceControlInfo() override;
|
||||
|
||||
bool AreAnyEntitiesSelected() override { return !m_selectedEntities.empty(); }
|
||||
int GetSelectedEntitiesCount() override { return m_selectedEntities.size(); }
|
||||
const EntityIdList& GetSelectedEntities() override { return m_selectedEntities; }
|
||||
const EntityIdList& GetHighlightedEntities() override { return m_highlightedEntities; }
|
||||
void SetSelectedEntities(const EntityIdList& selectedEntities) override;
|
||||
|
||||
-13
@@ -242,19 +242,6 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The template is already loaded, this is the case of either saving as same name or different name(loaded from before).
|
||||
// Update the template with the changes
|
||||
AzToolsFramework::Prefab::PrefabDom dom;
|
||||
bool success = AzToolsFramework::Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, dom);
|
||||
if (!success)
|
||||
{
|
||||
AZ_Error("Prefab", false, "Failed to convert current root instance into a DOM when saving file '%.*s'", AZ_STRING_ARG(filename));
|
||||
return false;
|
||||
}
|
||||
m_prefabSystemComponent->UpdatePrefabTemplate(templateId, dom);
|
||||
}
|
||||
|
||||
Prefab::TemplateId prevTemplateId = m_rootInstance->GetTemplateId();
|
||||
m_rootInstance->SetTemplateId(templateId);
|
||||
|
||||
+1
-1
@@ -200,7 +200,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
return context.Report(result,
|
||||
result.GetProcessing() == JSR::Processing::Completed ? "Succesfully loaded instance information for prefab." :
|
||||
result.GetProcessing() == JSR::Processing::Completed ? "Successfully loaded instance information for prefab." :
|
||||
"Failed to load instance information for prefab");
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,10 @@ namespace AzToolsFramework
|
||||
AZ_Assert(instanceDom.IsObject(), "Link Id '%u' cannot be added because the DOM of the instance is not an object.", m_id);
|
||||
instanceDom.AddMember(rapidjson::StringRef(PrefabDomUtils::LinkIdName), rapidjson::Value().SetUint64(m_id), allocator);
|
||||
}
|
||||
else
|
||||
{
|
||||
linkIdReference->get().SetUint64(m_id);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Prefab
|
||||
|
||||
@@ -392,12 +392,27 @@ namespace AzToolsFramework
|
||||
|
||||
if (patch.IsArray() && !patch.Empty() && beforeState.IsObject())
|
||||
{
|
||||
// Update the state of the entity
|
||||
PrefabUndoEntityUpdate* state = aznew PrefabUndoEntityUpdate(AZStd::to_string(static_cast<AZ::u64>(entityId)));
|
||||
state->SetParent(parentUndoBatch);
|
||||
state->Capture(beforeState, afterState, entityId);
|
||||
if (IsInstanceContainerEntity(entityId) && !IsLevelInstanceContainerEntity(entityId))
|
||||
{
|
||||
m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, entityId);
|
||||
|
||||
state->Redo();
|
||||
// Save these changes as patches to the link
|
||||
PrefabUndoLinkUpdate* linkUpdate =
|
||||
aznew PrefabUndoLinkUpdate(AZStd::to_string(static_cast<AZ::u64>(entityId)));
|
||||
linkUpdate->SetParent(parentUndoBatch);
|
||||
linkUpdate->Capture(patch, owningInstance->get().GetLinkId());
|
||||
|
||||
linkUpdate->Redo();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the state of the entity
|
||||
PrefabUndoEntityUpdate* state = aznew PrefabUndoEntityUpdate(AZStd::to_string(static_cast<AZ::u64>(entityId)));
|
||||
state->SetParent(parentUndoBatch);
|
||||
state->Capture(beforeState, afterState, entityId);
|
||||
|
||||
state->Redo();
|
||||
}
|
||||
}
|
||||
|
||||
// Update the cache
|
||||
|
||||
@@ -81,12 +81,17 @@ namespace UnitTest
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
anyEntitySelected, &ToolsApplicationRequests::AreAnyEntitiesSelected);
|
||||
|
||||
int selectedEntitiesCount = 0;
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntitiesCount, &ToolsApplicationRequests::GetSelectedEntitiesCount);
|
||||
|
||||
EntityIdList selectedEntityIds;
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
EXPECT_TRUE(testEntitySelected);
|
||||
EXPECT_TRUE(anyEntitySelected);
|
||||
EXPECT_EQ(selectedEntitiesCount, 1);
|
||||
EXPECT_EQ(selectedEntityIds.size(), 1);
|
||||
EXPECT_EQ(selectedEntityIds.front(), testEntityId);
|
||||
|
||||
@@ -100,11 +105,15 @@ namespace UnitTest
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
anyEntitySelected, &ToolsApplicationRequests::AreAnyEntitiesSelected);
|
||||
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntitiesCount, &ToolsApplicationRequests::GetSelectedEntitiesCount);
|
||||
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
EXPECT_FALSE(testEntitySelected);
|
||||
EXPECT_FALSE(anyEntitySelected);
|
||||
EXPECT_EQ(selectedEntitiesCount, 0);
|
||||
EXPECT_TRUE(selectedEntityIds.empty());
|
||||
}
|
||||
|
||||
@@ -141,11 +150,16 @@ namespace UnitTest
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
anyEntitySelected, &ToolsApplicationRequests::AreAnyEntitiesSelected);
|
||||
|
||||
int selectedEntitiesCount = 0;
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntitiesCount, &ToolsApplicationRequests::GetSelectedEntitiesCount);
|
||||
|
||||
EntityIdList actualSelectedEntityIds;
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
actualSelectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
EXPECT_TRUE(anyEntitySelected);
|
||||
EXPECT_EQ(selectedEntitiesCount, expectedSelectedEntityIds.size());
|
||||
EXPECT_EQ(actualSelectedEntityIds.size(), expectedSelectedEntityIds.size());
|
||||
for (auto& id : expectedSelectedEntityIds)
|
||||
{
|
||||
@@ -160,10 +174,14 @@ namespace UnitTest
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
anyEntitySelected, &ToolsApplicationRequests::AreAnyEntitiesSelected);
|
||||
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntitiesCount, &ToolsApplicationRequests::GetSelectedEntitiesCount);
|
||||
|
||||
ToolsApplicationRequestBus::BroadcastResult(
|
||||
actualSelectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
EXPECT_TRUE(anyEntitySelected);
|
||||
EXPECT_EQ(selectedEntitiesCount, expectedSelectedEntityIds.size());
|
||||
EXPECT_EQ(actualSelectedEntityIds.size(), expectedSelectedEntityIds.size());
|
||||
for (auto& id : expectedSelectedEntityIds)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user