/* * 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 * */ #include #include #include namespace GraphModelIntegration { FloatDataInterface::FloatDataInterface(GraphModel::SlotPtr slot) : m_slot(slot) { } double FloatDataInterface::GetNumber() const { GraphModel::SlotPtr slot = m_slot.lock(); return slot ? slot->GetValue() : 0.0; } void FloatDataInterface::SetNumber(double value) { GraphModel::SlotPtr slot = m_slot.lock(); if (slot && slot->GetValue() != static_cast(value)) { const GraphCanvas::GraphId graphCanvasSceneId = GetDisplay()->GetSceneId(); GraphCanvas::ScopedGraphUndoBatch undoBatch(graphCanvasSceneId); slot->SetValue(static_cast(value)); GraphControllerNotificationBus::Event(graphCanvasSceneId, &GraphControllerNotifications::OnGraphModelSlotModified, slot); GraphControllerNotificationBus::Event( graphCanvasSceneId, &GraphControllerNotifications::OnGraphModelGraphModified, slot->GetParentNode()); } } double FloatDataInterface::GetMin() const { return std::numeric_limits::lowest(); } double FloatDataInterface::GetMax() const { return std::numeric_limits::max(); } } // namespace GraphModelIntegration