2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-20 23:39:13 +00:00

Mesh cooker updates

This commit is contained in:
Jack Andersen
2015-10-06 15:16:54 -10:00
parent f0325f7946
commit 135a7ced5d
10 changed files with 215 additions and 106 deletions

View File

@@ -371,7 +371,8 @@ static void VisitFile(const ProjectPath& path,
if (spec.second->canCook(path))
{
ProjectPath cooked = path.getCookedPath(*spec.first);
if (path.getModtime() > cooked.getModtime())
if (cooked.getPathType() == ProjectPath::PT_NONE ||
path.getModtime() > cooked.getModtime())
{
progress.reportFile(spec.first);
spec.second->doCook(path, cooked);
@@ -398,6 +399,13 @@ static void VisitDirectory(const ProjectPath& dir, bool recursive,
++childFileCount;
break;
}
case ProjectPath::PT_LINK:
{
ProjectPath target = child.resolveLink();
if (target.getPathType() == ProjectPath::PT_FILE)
++childFileCount;
break;
}
default: break;
}
}
@@ -416,6 +424,16 @@ static void VisitDirectory(const ProjectPath& dir, bool recursive,
VisitFile(child, specInsts, progress);
break;
}
case ProjectPath::PT_LINK:
{
ProjectPath target = child.resolveLink();
if (target.getPathType() == ProjectPath::PT_FILE)
{
progress.changeFile(target.getLastComponent(), progNum++/progDenom);
VisitFile(target, specInsts, progress);
}
break;
}
default: break;
}
}
@@ -457,6 +475,13 @@ static void VisitGlob(const ProjectPath& path, bool recursive,
++childFileCount;
break;
}
case ProjectPath::PT_LINK:
{
ProjectPath target = path.resolveLink();
if (target.getPathType() == ProjectPath::PT_FILE)
++childFileCount;
break;
}
default: break;
}
}
@@ -475,6 +500,16 @@ static void VisitGlob(const ProjectPath& path, bool recursive,
VisitFile(child, specInsts, progress);
break;
}
case ProjectPath::PT_LINK:
{
ProjectPath target = path.resolveLink();
if (target.getPathType() == ProjectPath::PT_FILE)
{
progress.changeFile(target.getLastComponent(), progNum++/progDenom);
VisitFile(target, specInsts, progress);
}
break;
}
default: break;
}
}
@@ -518,6 +553,16 @@ bool Project::cookPath(const ProjectPath& path, FProgress progress, bool recursi
VisitFile(path, specInsts, cookProg);
break;
}
case ProjectPath::PT_LINK:
{
ProjectPath target = path.resolveLink();
if (target.getPathType() == ProjectPath::PT_FILE)
{
cookProg.changeFile(target.getLastComponent(), 0.0);
VisitFile(target, specInsts, cookProg);
}
break;
}
case ProjectPath::PT_DIRECTORY:
{
VisitDirectory(path, recursive, specInsts, cookProg);

View File

@@ -49,6 +49,9 @@ bool IsPathPNG(const HECL::ProjectPath& path)
bool IsPathBlend(const HECL::ProjectPath& path)
{
const SystemChar* lastCompExt = path.getLastComponentExt();
if (!lastCompExt || HECL::StrCmp(lastCompExt, _S("blend")))
return false;
FILE* fp = HECL::Fopen(path.getAbsolutePath().c_str(), _S("rb"));
if (!fp)
return false;

View File

@@ -225,7 +225,7 @@ ProjectPath ProjectPath::resolveLink() const
LogModule.report(LogVisor::FatalError, _S("unable to resolve link '%s': %s"), m_absPath.c_str(), strerror(errno));
target[targetSz] = '\0';
#endif
return ProjectPath(*this, target);
return ProjectPath(getParentPath(), target);
}
static void _recursiveGlob(Database::Project& proj,