mirror of https://github.com/AxioDL/metaforce.git
Aux info functionality for ProjectPath
This commit is contained in:
parent
635193c2fe
commit
41dbd30970
|
@ -430,6 +430,14 @@ bool BlenderConnection::openBlend(const ProjectPath& path, bool force)
|
|||
}
|
||||
++idx;
|
||||
}
|
||||
m_loadedRigged = false;
|
||||
if (m_loadedType == BlendType::Mesh)
|
||||
{
|
||||
_writeLine("GETMESHRIGGED");
|
||||
_readLine(lineBuf, sizeof(lineBuf));
|
||||
if (!strcmp("TRUE", lineBuf))
|
||||
m_loadedRigged = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -57,6 +57,7 @@ private:
|
|||
int m_readpipe[2];
|
||||
int m_writepipe[2];
|
||||
BlendType m_loadedType = BlendType::None;
|
||||
bool m_loadedRigged = false;
|
||||
ProjectPath m_loadedBlend;
|
||||
std::string m_startupBlend;
|
||||
size_t _readLine(char* buf, size_t bufSz);
|
||||
|
@ -70,6 +71,7 @@ public:
|
|||
|
||||
bool createBlend(const ProjectPath& path, BlendType type);
|
||||
BlendType getBlendType() const {return m_loadedType;}
|
||||
bool getRigged() const {return m_loadedRigged;}
|
||||
bool openBlend(const ProjectPath& path, bool force=false);
|
||||
bool saveBlend();
|
||||
void deleteBlend();
|
||||
|
|
|
@ -221,6 +221,16 @@ while True:
|
|||
elif cmdargs[0] == 'GETTYPE':
|
||||
writepipeline(bpy.context.scene.hecl_type.encode())
|
||||
|
||||
elif cmdargs[0] == 'GETMESHRIGGED':
|
||||
meshName = bpy.context.scene.hecl_mesh_obj
|
||||
if meshName not in bpy.data.objects:
|
||||
writepipeline(b'FALSE')
|
||||
else:
|
||||
if len(bpy.data.objects[meshName].vertex_groups):
|
||||
writepipeline(b'TRUE')
|
||||
else:
|
||||
writepipeline(b'FALSE')
|
||||
|
||||
elif cmdargs[0] == 'SAVE':
|
||||
bpy.context.user_preferences.filepaths.save_version = 0
|
||||
if 'FINISHED' in bpy.ops.wm.save_mainfile(check_existing=False, compress=True):
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 23f49fcc19f2ef2be2e272ba00bfed863eaea423
|
||||
Subproject commit 4cec163804dd293818029d838dda512c7b985aaf
|
|
@ -765,10 +765,12 @@ class ProjectPath
|
|||
Database::Project* m_proj = nullptr;
|
||||
SystemString m_absPath;
|
||||
SystemString m_relPath;
|
||||
SystemString m_auxInfo;
|
||||
Hash m_hash = 0;
|
||||
#if HECL_UCS2
|
||||
std::string m_utf8AbsPath;
|
||||
std::string m_utf8RelPath;
|
||||
std::string m_utf8AuxInfo;
|
||||
#endif
|
||||
public:
|
||||
/**
|
||||
|
@ -1048,6 +1050,20 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
const SystemString& getAuxInfo() const
|
||||
{
|
||||
return m_auxInfo;
|
||||
}
|
||||
|
||||
const std::string& getAuxInfoUTF8() const
|
||||
{
|
||||
#if HECL_UCS2
|
||||
return m_utf8AuxInfo;
|
||||
#else
|
||||
return m_auxInfo;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Type of path
|
||||
*/
|
||||
|
|
|
@ -63,7 +63,18 @@ static SystemString CanonRelPath(const SystemString& path, const ProjectRootPath
|
|||
void ProjectPath::assign(Database::Project& project, const SystemString& path)
|
||||
{
|
||||
m_proj = &project;
|
||||
m_relPath = CanonRelPath(path);
|
||||
|
||||
SystemString usePath;
|
||||
size_t pipeFind = path.rfind(_S('|'));
|
||||
if (pipeFind != SystemString::npos)
|
||||
{
|
||||
m_auxInfo.assign(path.cbegin() + pipeFind + 1, path.cend());
|
||||
usePath.assign(path.cbegin(), path.cbegin() + pipeFind);
|
||||
}
|
||||
else
|
||||
usePath = path;
|
||||
|
||||
m_relPath = CanonRelPath(usePath);
|
||||
m_absPath = project.getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath;
|
||||
SanitizePath(m_relPath);
|
||||
SanitizePath(m_absPath);
|
||||
|
@ -71,8 +82,15 @@ void ProjectPath::assign(Database::Project& project, const SystemString& path)
|
|||
#if HECL_UCS2
|
||||
m_utf8AbsPath = WideToUTF8(m_absPath);
|
||||
m_utf8RelPath = WideToUTF8(m_relPath);
|
||||
m_utf8AuxInfo = WideToUTF8(m_auxInfo);
|
||||
if (m_utf8AuxInfo.size())
|
||||
m_hash = Hash(m_utf8RelPath + '|' + m_utf8AuxInfo);
|
||||
else
|
||||
m_hash = Hash(m_utf8RelPath);
|
||||
#else
|
||||
if (m_auxInfo.size())
|
||||
m_hash = Hash(m_relPath + '|' + m_auxInfo);
|
||||
else
|
||||
m_hash = Hash(m_relPath);
|
||||
#endif
|
||||
}
|
||||
|
@ -80,22 +98,26 @@ void ProjectPath::assign(Database::Project& project, const SystemString& path)
|
|||
#if HECL_UCS2
|
||||
void ProjectPath::assign(Database::Project& project, const std::string& path)
|
||||
{
|
||||
m_proj = &project;
|
||||
std::wstring wpath = UTF8ToWide(path);
|
||||
m_relPath = CanonRelPath(wpath);
|
||||
m_absPath = project.getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath;
|
||||
SanitizePath(m_relPath);
|
||||
SanitizePath(m_absPath);
|
||||
m_utf8AbsPath = WideToUTF8(m_absPath);
|
||||
m_utf8RelPath = WideToUTF8(m_relPath);
|
||||
m_hash = Hash(m_utf8RelPath);
|
||||
assign(project, wpath);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ProjectPath::assign(const ProjectPath& parentPath, const SystemString& path)
|
||||
{
|
||||
m_proj = parentPath.m_proj;
|
||||
m_relPath = CanonRelPath(parentPath.m_relPath + _S('/') + path);
|
||||
|
||||
SystemString usePath;
|
||||
size_t pipeFind = path.rfind(_S('|'));
|
||||
if (pipeFind != SystemString::npos)
|
||||
{
|
||||
m_auxInfo.assign(path.cbegin() + pipeFind + 1, path.cend());
|
||||
usePath.assign(path.cbegin(), path.cbegin() + pipeFind);
|
||||
}
|
||||
else
|
||||
usePath = path;
|
||||
|
||||
m_relPath = CanonRelPath(parentPath.m_relPath + _S('/') + usePath);
|
||||
m_absPath = m_proj->getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath;
|
||||
SanitizePath(m_relPath);
|
||||
SanitizePath(m_absPath);
|
||||
|
@ -103,8 +125,15 @@ void ProjectPath::assign(const ProjectPath& parentPath, const SystemString& path
|
|||
#if HECL_UCS2
|
||||
m_utf8AbsPath = WideToUTF8(m_absPath);
|
||||
m_utf8RelPath = WideToUTF8(m_relPath);
|
||||
m_utf8AuxInfo = WideToUTF8(m_auxInfo);
|
||||
if (m_utf8AuxInfo.size())
|
||||
m_hash = Hash(m_utf8RelPath + '|' + m_utf8AuxInfo);
|
||||
else
|
||||
m_hash = Hash(m_utf8RelPath);
|
||||
#else
|
||||
if (m_auxInfo.size())
|
||||
m_hash = Hash(m_relPath + '|' + m_auxInfo);
|
||||
else
|
||||
m_hash = Hash(m_relPath);
|
||||
#endif
|
||||
}
|
||||
|
@ -112,15 +141,8 @@ void ProjectPath::assign(const ProjectPath& parentPath, const SystemString& path
|
|||
#if HECL_UCS2
|
||||
void ProjectPath::assign(const ProjectPath& parentPath, const std::string& path)
|
||||
{
|
||||
m_proj = parentPath.m_proj;
|
||||
std::wstring wpath = UTF8ToWide(path);
|
||||
m_relPath = CanonRelPath(parentPath.m_relPath + _S('/') + wpath);
|
||||
m_absPath = m_proj->getProjectRootPath().getAbsolutePath() + _S('/') + m_relPath;
|
||||
SanitizePath(m_relPath);
|
||||
SanitizePath(m_absPath);
|
||||
m_utf8AbsPath = WideToUTF8(m_absPath);
|
||||
m_utf8RelPath = WideToUTF8(m_relPath);
|
||||
m_hash = Hash(m_utf8RelPath);
|
||||
assign(parentPath, wpath);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue