/* * 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 * */ // AZ #include // Graph Model #include #include #include namespace GraphModelIntegration { StringDataInterface::StringDataInterface(GraphModel::SlotPtr slot) : m_slot(slot) { } AZStd::string StringDataInterface::GetString() const { if (GraphModel::SlotPtr slot = m_slot.lock()) { return slot->GetValue(); } else { return ""; } } void StringDataInterface::SetString(const AZStd::string& value) { if (GraphModel::SlotPtr slot = m_slot.lock()) { AZStd::string trimValue = value; AzFramework::StringFunc::TrimWhiteSpace(trimValue, true, true); if (trimValue != slot->GetValue()) { const GraphCanvas::GraphId graphCanvasSceneId = GetDisplay()->GetSceneId(); GraphCanvas::ScopedGraphUndoBatch undoBatch(graphCanvasSceneId); slot->SetValue(trimValue); GraphControllerNotificationBus::Event( graphCanvasSceneId, &GraphControllerNotifications::OnGraphModelSlotModified, slot); GraphControllerNotificationBus::Event( graphCanvasSceneId, &GraphControllerNotifications::OnGraphModelGraphModified, slot->GetParentNode()); } } } }