Gems/Atom/RPI/Code/Source/RPI.Builders/Material/MaterialBuilder.cpp
void AddPossibleDependencies(AZStd::string_view currentFilePath,
            AZStd::string_view referencedParentPath,
            const char* jobKey,
            AZStd::vector<AssetBuilderSDK::JobDependency>& jobDependencies,
            bool isOrderedOnceForMaterialTypes = false)
        {
            bool dependencyFileFound = false;

            AZStd::vector<AZStd::string> possibleDependencies = RPI::AssetUtils::GetPossibleDepenencyPaths(currentFilePath, referencedParentPath);
            for (auto& file : possibleDependencies)
            {
                // The first path found is the highest priority, and will have a job dependency, as this is the one
                // the builder will actually use
                if (!dependencyFileFound)
                {
                    AZ::Data::AssetInfo sourceInfo;
                    AZStd::string watchFolder;
                    AzToolsFramework::AssetSystemRequestBus::BroadcastResult(dependencyFileFound, &AzToolsFramework::AssetSystem::AssetSystemRequest::GetSourceInfoBySourcePath, file.c_str(), sourceInfo, watchFolder);

                    if (dependencyFileFound)
                    {
                        AssetBuilderSDK::JobDependency jobDependency;
                        jobDependency.m_jobKey = jobKey;
                        jobDependency.m_sourceFile.m_sourceFileDependencyPath = file;

                        const bool isMaterialTypeFile = AzFramework::StringFunc::Path::IsExtension(file.c_str(), MaterialTypeSourceData::Extension);
                        jobDependency.m_type = (isMaterialTypeFile && isOrderedOnceForMaterialTypes) ? AssetBuilderSDK::JobDependencyType::OrderOnce : AssetBuilderSDK::JobDependencyType::Order;

                        jobDependencies.push_back(jobDependency);
                    }
                }
            }
        }
//! Adds all relevant dependencies for a referenced source file, considering that the path might be relative to the original file location or a full asset path.
//! This will usually include multiple source dependencies and a single job dependency, but will include only source dependencies if the file is not found.
//! Note the AssetBuilderSDK::JobDependency::m_platformIdentifier will not be set by this function. The calling code must set this value before passing back
//! to the AssetBuilderSDK::CreateJobsResponse. If isOrderedOnceForMaterialTypes is true and the dependency is a .materialtype file, the job dependency type
//! will be set to JobDependencyType::OrderOnce.
Adds all relevant dependencies for a referenced source file, considering that the path might be relative to the original file location or a full asset path.
This will usually include multiple source dependencies and a single job dependency, but will include only source dependencies if the file is not found.
Note the AssetBuilderSDK::JobDependency::m_platformIdentifier will not be set by this function. The calling code must set this value before passing back
to the AssetBuilderSDK::CreateJobsResponse. If isOrderedOnceForMaterialTypes is true and the dependency is a .materialtype file, the job dependency type
will be set to JobDependencyType::OrderOnce.
Adds all relevant dependencies for a referenced source file considering that the path might be relative to the original file location or a full asset path . This will usually include multiple source dependencies and a single job dependency but will include only source dependencies if the file is not found . Note the AssetBuilderSDK :: JobDependency :: m_platformIdentifier will not be set by this function . The calling code must set this value before passing back to the AssetBuilderSDK :: CreateJobsResponse . If isOrderedOnceForMaterialTypes is true and the dependency is a . materialtype file the job dependency type will be set to JobDependencyType :: OrderOnce .
void AddPossibleDependencies(AZStd::string_view currentFilePath,
            AZStd::string_view referencedParentPath,
            const char* jobKey,
            AZStd::vector<AssetBuilderSDK::JobDependency>& jobDependencies,
            bool isOrderedOnceForMaterialTypes = false)
        {
            bool dependencyFileFound = false;
            AZStd::vector<AZStd::string> possibleDependencies = RPI::AssetUtils::GetPossibleDepenencyPaths(currentFilePath, referencedParentPath);
            for (auto& file : possibleDependencies)
            {
                if (!dependencyFileFound)
                {
                    AZ::Data::AssetInfo sourceInfo;
                    AZStd::string watchFolder;
                    AzToolsFramework::AssetSystemRequestBus::BroadcastResult(dependencyFileFound, &AzToolsFramework::AssetSystem::AssetSystemRequest::GetSourceInfoBySourcePath, file.c_str(), sourceInfo, watchFolder);
                    if (dependencyFileFound)
                    {
                        AssetBuilderSDK::JobDependency jobDependency;
                        jobDependency.m_jobKey = jobKey;
                        jobDependency.m_sourceFile.m_sourceFileDependencyPath = file;
                        const bool isMaterialTypeFile = AzFramework::StringFunc::Path::IsExtension(file.c_str(), MaterialTypeSourceData::Extension);
                        jobDependency.m_type = (isMaterialTypeFile && isOrderedOnceForMaterialTypes) ? AssetBuilderSDK::JobDependencyType::OrderOnce : AssetBuilderSDK::JobDependencyType::Order;
                        jobDependencies.push_back(jobDependency);
                    }
                }
            }
        }
void AddPossibleDependencies ( AZStd :: string_view currentFilePath , AZStd :: string_view referencedParentPath , const char * jobKey , AZStd :: vector < AssetBuilderSDK :: JobDependency > & jobDependencies , bool isOrderedOnceForMaterialTypes = false ) { bool dependencyFileFound = false ; AZStd :: vector < AZStd :: string > possibleDependencies = RPI :: AssetUtils :: GetPossibleDepenencyPaths ( currentFilePath , referencedParentPath ) ; for ( auto & file : possibleDependencies ) { if ( ! dependencyFileFound ) { AZ :: Data :: AssetInfo sourceInfo ; AZStd :: string watchFolder ; AzToolsFramework :: AssetSystemRequestBus :: BroadcastResult ( dependencyFileFound , & AzToolsFramework :: AssetSystem :: AssetSystemRequest :: GetSourceInfoBySourcePath , file . c_str ( ) , sourceInfo , watchFolder ) ; if ( dependencyFileFound ) { AssetBuilderSDK :: JobDependency jobDependency ; jobDependency . m_jobKey = jobKey ; jobDependency . m_sourceFile . m_sourceFileDependencyPath = file ; const bool isMaterialTypeFile = AzFramework :: StringFunc :: Path :: IsExtension ( file . c_str ( ) , MaterialTypeSourceData :: Extension ) ; jobDependency . m_type = ( isMaterialTypeFile && isOrderedOnceForMaterialTypes ) ? AssetBuilderSDK :: JobDependencyType :: OrderOnce : AssetBuilderSDK :: JobDependencyType :: Order ; jobDependencies . push_back ( jobDependency ) ; } } } }
Adds all relevant dependencies for a referenced source file, considering that the path might be relative to the original file location or a full asset path.
Adds all relevant dependencies for a referenced source file considering that the path might be relative to the original file location or a full asset path .
// The first path found is the highest priority, and will have a job dependency, as this is the one // the builder will actually use