Gems/LandscapeCanvas/Code/Source/Editor/Menus/NodeContextMenu.cpp
QAction* GetNodeSelectInEditorAction(const AZ::EntityId& sceneId, QObject* parent)
    {
        // Retrieve the selected nodes in our scene
        GraphModel::NodePtrList nodeList;
        GraphModelIntegration::GraphControllerRequestBus::EventResult(nodeList, sceneId, &GraphModelIntegration::GraphControllerRequests::GetSelectedNodes);

        // Iterate through the selected nodes to find their corresponding vegetation entities
        AzToolsFramework::EntityIdList vegetationEntityIdsToSelect;
        for (const auto& node : nodeList)
        {
            if (!node)
            {
                continue;
            }

            auto baseNodePtr = static_cast<LandscapeCanvas::BaseNode*>(node.get());
            vegetationEntityIdsToSelect.push_back(baseNodePtr->GetVegetationEntityId());
        }

        QAction* action = new QAction({ vegetationEntityIdsToSelect.size() > 1 ? QObject::tr("Select Entities in Editor") : QObject::tr("Select Entity in Editor") }, parent);

        QString tooltip = QObject::tr("Select the corresponding Entity/Entities in the Editor for the selected node(s) in the graph");
        action->setToolTip(tooltip);
        action->setStatusTip(tooltip);

        QObject::connect(action,
            &QAction::triggered,
            [vegetationEntityIdsToSelect](bool)
        {
            // Set the new selection
            AzToolsFramework::ToolsApplicationRequestBus::Broadcast(&AzToolsFramework::ToolsApplicationRequestBus::Events::SetSelectedEntities, vegetationEntityIdsToSelect);
        });

        return action;
    }
// Select the corresponding Entities in the Editor based on the selected nodes in our scene graph
Select the corresponding Entities in the Editor based on the selected nodes in our scene graph
Select the corresponding Entities in the Editor based on the selected nodes in our scene graph
QAction* GetNodeSelectInEditorAction(const AZ::EntityId& sceneId, QObject* parent)
    {
        GraphModel::NodePtrList nodeList;
        GraphModelIntegration::GraphControllerRequestBus::EventResult(nodeList, sceneId, &GraphModelIntegration::GraphControllerRequests::GetSelectedNodes);
        AzToolsFramework::EntityIdList vegetationEntityIdsToSelect;
        for (const auto& node : nodeList)
        {
            if (!node)
            {
                continue;
            }
            auto baseNodePtr = static_cast<LandscapeCanvas::BaseNode*>(node.get());
            vegetationEntityIdsToSelect.push_back(baseNodePtr->GetVegetationEntityId());
        }
        QAction* action = new QAction({ vegetationEntityIdsToSelect.size() > 1 ? QObject::tr("Select Entities in Editor") : QObject::tr("Select Entity in Editor") }, parent);
        QString tooltip = QObject::tr("Select the corresponding Entity/Entities in the Editor for the selected node(s) in the graph");
        action->setToolTip(tooltip);
        action->setStatusTip(tooltip);
        QObject::connect(action,
            &QAction::triggered,
            [vegetationEntityIdsToSelect](bool)
        {
            AzToolsFramework::ToolsApplicationRequestBus::Broadcast(&AzToolsFramework::ToolsApplicationRequestBus::Events::SetSelectedEntities, vegetationEntityIdsToSelect);
        });
        return action;
    }
QAction * GetNodeSelectInEditorAction ( const AZ :: EntityId & sceneId , QObject * parent ) { GraphModel :: NodePtrList nodeList ; GraphModelIntegration :: GraphControllerRequestBus :: EventResult ( nodeList , sceneId , & GraphModelIntegration :: GraphControllerRequests :: GetSelectedNodes ) ; AzToolsFramework :: EntityIdList vegetationEntityIdsToSelect ; for ( const auto & node : nodeList ) { if ( ! node ) { continue ; } auto baseNodePtr = static_cast < LandscapeCanvas :: BaseNode * > ( node . get ( ) ) ; vegetationEntityIdsToSelect . push_back ( baseNodePtr -> GetVegetationEntityId ( ) ) ; } QAction * action = new QAction ( { vegetationEntityIdsToSelect . size ( ) > 1 ? QObject :: tr ( " " ) : QObject :: tr ( " " ) } , parent ) ; QString tooltip = QObject :: tr ( " " ) ; action -> setToolTip ( tooltip ) ; action -> setStatusTip ( tooltip ) ; QObject :: connect ( action , & QAction :: triggered , [ vegetationEntityIdsToSelect ] ( bool ) { AzToolsFramework :: ToolsApplicationRequestBus :: Broadcast ( & AzToolsFramework :: ToolsApplicationRequestBus :: Events :: SetSelectedEntities , vegetationEntityIdsToSelect ) ; } ) ; return action ; }
Select the corresponding Entities in the Editor based on the selected nodes in our scene graph
Select the corresponding Entities in the Editor based on the selected nodes in our scene graph
// Retrieve the selected nodes in our scene // Iterate through the selected nodes to find their corresponding vegetation entities // Set the new selection