Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.cpp
void ClearParametersCommand(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup)
    {
        const EMotionFX::ValueParameterVector parameters = animGraph->RecursivelyGetValueParameters();
        if (parameters.empty())
        {
            return;
        }

        // Iterate through all parameters and fill the parameter name array.
        AZStd::vector<AZStd::string> parameterNames;
        parameterNames.reserve(static_cast<size_t>(parameters.size()));
        for (const EMotionFX::ValueParameter* parameter : parameters)
        {
            parameterNames.push_back(parameter->GetName());
        }

        // Is the command group parameter set?
        if (!commandGroup)
        {
            // Create and fill the command group.
            AZStd::string outResult;
            MCore::CommandGroup internalCommandGroup("Clear parameters");
            BuildRemoveParametersCommandGroup(animGraph, parameterNames, &internalCommandGroup);

            // Execute the command group.
            if (!GetCommandManager()->ExecuteCommandGroup(internalCommandGroup, outResult))
            {
                AZ_Error("EMotionFX", false, outResult.c_str());
            }
        }
        else
        {
            // Use the given parameter command group.
            BuildRemoveParametersCommandGroup(animGraph, parameterNames, commandGroup);
        }
    }
//--------------------------------------------------------------------------------
// Remove and or clear parameter helper functions
//--------------------------------------------------------------------------------
Remove and or clear parameter helper functions
Remove and or clear parameter helper functions
void ClearParametersCommand(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup)
    {
        const EMotionFX::ValueParameterVector parameters = animGraph->RecursivelyGetValueParameters();
        if (parameters.empty())
        {
            return;
        }
        AZStd::vector<AZStd::string> parameterNames;
        parameterNames.reserve(static_cast<size_t>(parameters.size()));
        for (const EMotionFX::ValueParameter* parameter : parameters)
        {
            parameterNames.push_back(parameter->GetName());
        }
        if (!commandGroup)
        {
            AZStd::string outResult;
            MCore::CommandGroup internalCommandGroup("Clear parameters");
            BuildRemoveParametersCommandGroup(animGraph, parameterNames, &internalCommandGroup);
            if (!GetCommandManager()->ExecuteCommandGroup(internalCommandGroup, outResult))
            {
                AZ_Error("EMotionFX", false, outResult.c_str());
            }
        }
        else
        {
            BuildRemoveParametersCommandGroup(animGraph, parameterNames, commandGroup);
        }
    }
void ClearParametersCommand ( EMotionFX :: AnimGraph * animGraph , MCore :: CommandGroup * commandGroup ) { const EMotionFX :: ValueParameterVector parameters = animGraph -> RecursivelyGetValueParameters ( ) ; if ( parameters . empty ( ) ) { return ; } AZStd :: vector < AZStd :: string > parameterNames ; parameterNames . reserve ( static_cast < size_t > ( parameters . size ( ) ) ) ; for ( const EMotionFX :: ValueParameter * parameter : parameters ) { parameterNames . push_back ( parameter -> GetName ( ) ) ; } if ( ! commandGroup ) { AZStd :: string outResult ; MCore :: CommandGroup internalCommandGroup ( " " ) ; BuildRemoveParametersCommandGroup ( animGraph , parameterNames , & internalCommandGroup ) ; if ( ! GetCommandManager ( ) -> ExecuteCommandGroup ( internalCommandGroup , outResult ) ) { AZ_Error ( " " , false , outResult . c_str ( ) ) ; } } else { BuildRemoveParametersCommandGroup ( animGraph , parameterNames , commandGroup ) ; } }
Remove and or clear parameter helper functions
Remove and or clear parameter helper functions
// Iterate through all parameters and fill the parameter name array. // Is the command group parameter set? // Create and fill the command group. // Execute the command group. // Use the given parameter command group.