static std::shared_ptr<MaterialScaffold> CreateMaterialScaffold( const ::Assets::ResChar model[], const ::Assets::ResChar material[], RenderCore::Assets::IModelFormat& modelFormat) { // note -- we need to remove any parameters after ':' in the model name // these are references to sub-nodes within the model hierarchy // (which are irrelevant when dealing with materials, since the // materials are shared for the entire model file) ::Assets::ResChar temp[MaxPath]; const auto paramStart = XlFindChar(model, (::Assets::ResChar)':'); if (paramStart) { XlCopyString(temp, MakeStringSection(model, paramStart)); model = temp; } auto& compilers = ::Assets::Services::GetAsyncMan().GetIntermediateCompilers(); auto& store = ::Assets::Services::GetAsyncMan().GetIntermediateStore(); const ::Assets::ResChar* inits[] = { material, model }; auto marker = compilers.PrepareAsset( MaterialScaffold::CompileProcessType, inits, dimof(inits), store); if (!marker) return nullptr; return std::make_shared<MaterialScaffold>(std::move(marker)); }
void DivergentAssetBase::AssetIdentifier::OnChange() { // We need to mark the target file invalidated. // this is a little strange, because the target file // hasn't actually changed. // // But this is required because some dependent assets // don't have a dependency on the asset itself (just // on the underlying file). Invalidating the file ensures // that we invoke a update on all assets that require it. if (_targetFilename.empty()) return; auto fn = _targetFilename; auto paramStart = fn.find_last_of(':'); auto end = fn.cend(); if (paramStart != std::basic_string<ResChar>::npos) end = fn.cbegin() + paramStart; Services::GetAsyncMan().GetIntermediateStore().ShadowFile(MakeStringSection(AsPointer(fn.cbegin()), AsPointer(end))); }