struct DepTreeElement *ProcessDep (BuildTreeConfig* cfg, soff_entry *soffs, int soffs_len, DWORD name, struct DepTreeElement *root, struct DepTreeElement *self, int deep) { struct DepTreeElement *child = NULL; int found; int64_t i; char *dllname = (char *) MapPointer (soffs, soffs_len, name, NULL); if (dllname == NULL) return NULL; if (strlen (dllname) > 10 && strnicmp ("api-ms-win", dllname, 10) == 0) { /* TODO: find a better way to identify api stubs. Versioninfo, maybe? */ return NULL; } for (i = (int64_t)*cfg->stack_len - 1; i >= 0; i--) { if ((*cfg->stack)[i] && stricmp ((*cfg->stack)[i], dllname) == 0) return NULL; if (i == 0) break; } found = FindDep (root, dllname, &child); if (found < 0) { child = (struct DepTreeElement *) malloc (sizeof (struct DepTreeElement)); memset (child, 0, sizeof (struct DepTreeElement)); if (deep == 0) { child->module = strdup (dllname); AddDep (self, child); } } if (deep == 1) { BuildDepTree (cfg, dllname, root, child); } return child; }
void cElTask::AddDep(const std::string & aName) { AddDep(mGPAO.TaskOfName(aName)); }
static ::Assets::CompilerHelper::CompileResult CompileMaterialScaffold( const ::Assets::ResChar sourceMaterial[], const ::Assets::ResChar sourceModel[], const ::Assets::ResChar destination[]) { // Parameters must be stripped off the source model filename before we get here. // the parameters are irrelevant to the compiler -- so if they stay on the request // name, will we end up with multiple assets that are equivalent assert(MakeFileNameSplitter(sourceModel).ParametersWithDivider().Empty()); // note -- we can throw pending & invalid from here... auto& modelMat = ::Assets::GetAssetComp<RawMatConfigurations>(sourceModel); std::vector<::Assets::DependentFileState> deps; // for each configuration, we want to build a resolved material // Note that this is a bit crazy, because we're going to be loading // and re-parsing the same files over and over again! SerializableVector<std::pair<MaterialGuid, ResolvedMaterial>> resolved; SerializableVector<std::pair<MaterialGuid, std::string>> resolvedNames; resolved.reserve(modelMat._configurations.size()); auto searchRules = ::Assets::DefaultDirectorySearchRules(sourceModel); ::Assets::ResChar resolvedSourceMaterial[MaxPath]; ResolveMaterialFilename(resolvedSourceMaterial, dimof(resolvedSourceMaterial), searchRules, sourceMaterial); searchRules.AddSearchDirectoryFromFilename(resolvedSourceMaterial); AddDep(deps, sourceModel); // we need need a dependency (even if it's a missing file) using Meld = StringMeld<MaxPath, ::Assets::ResChar>; for (auto i=modelMat._configurations.cbegin(); i!=modelMat._configurations.cend(); ++i) { ResolvedMaterial resMat; std::basic_stringstream<::Assets::ResChar> resName; auto guid = MakeMaterialGuid(AsPointer(i->cbegin()), AsPointer(i->cend())); // Our resolved material comes from 3 separate inputs: // 1) model:configuration // 2) material:* // 3) material:configuration // // Some material information is actually stored in the model // source data. This is just for art-pipeline convenience -- // generally texture assignments (and other settings) are // set in the model authoring tool (eg, 3DS Max). The .material // files actually only provide overrides for settings that can't // be set within 3rd party tools. // // We don't combine the model and material information until // this step -- this gives us some flexibility to use the same // model with different material files. The material files can // also override settings from 3DS Max (eg, change texture assignments // etc). This provides a path for reusing the same model with // different material settings (eg, when we want one thing to have // a red version and a blue version) TRY { // resolve in model:configuration auto configName = Conversion::Convert<::Assets::rstring>(*i); Meld meld; meld << sourceModel << ":" << configName; resName << meld; auto& rawMat = RawMaterial::GetAsset(meld); rawMat._asset.Resolve(resMat, searchRules, &deps); } CATCH (const ::Assets::Exceptions::InvalidAsset&) { } CATCH_END if (resolvedSourceMaterial[0] != '\0') { AddDep(deps, resolvedSourceMaterial); // we need need a dependency (even if it's a missing file) TRY { // resolve in material:* Meld meld; meld << resolvedSourceMaterial << ":*"; resName << ";" << meld; auto& rawMat = RawMaterial::GetAsset(meld); rawMat._asset.Resolve(resMat, searchRules, &deps); } CATCH (const ::Assets::Exceptions::InvalidAsset&) { } CATCH_END TRY { // resolve in material:configuration Meld meld; meld << resolvedSourceMaterial << ":" << Conversion::Convert<::Assets::rstring>(*i); resName << ";" << meld; auto& rawMat = RawMaterial::GetAsset(meld); rawMat._asset.Resolve(resMat, searchRules, &deps); } CATCH (const ::Assets::Exceptions::InvalidAsset&) { } CATCH_END } resolved.push_back(std::make_pair(guid, std::move(resMat))); resolvedNames.push_back(std::make_pair(guid, resName.str())); }