diff --git a/hecl/blender/BlenderConnection.cpp b/hecl/blender/BlenderConnection.cpp index 8b1ef8c9f..07525b0d9 100644 --- a/hecl/blender/BlenderConnection.cpp +++ b/hecl/blender/BlenderConnection.cpp @@ -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; diff --git a/hecl/blender/BlenderConnection.hpp b/hecl/blender/BlenderConnection.hpp index 4beb8ec93..6877290af 100644 --- a/hecl/blender/BlenderConnection.hpp +++ b/hecl/blender/BlenderConnection.hpp @@ -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(); diff --git a/hecl/blender/hecl_blendershell.py b/hecl/blender/hecl_blendershell.py index 3c859d3f4..81f9c5e0f 100644 --- a/hecl/blender/hecl_blendershell.py +++ b/hecl/blender/hecl_blendershell.py @@ -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): diff --git a/hecl/extern/boo b/hecl/extern/boo index 23f49fcc1..4cec16380 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit 23f49fcc19f2ef2be2e272ba00bfed863eaea423 +Subproject commit 4cec163804dd293818029d838dda512c7b985aaf diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index 3bf9fe025..ad81ee868 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -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 */ diff --git a/hecl/lib/ProjectPath.cpp b/hecl/lib/ProjectPath.cpp index e3f418029..75f3f1031 100644 --- a/hecl/lib/ProjectPath.cpp +++ b/hecl/lib/ProjectPath.cpp @@ -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,31 +82,42 @@ void ProjectPath::assign(Database::Project& project, const SystemString& path) #if HECL_UCS2 m_utf8AbsPath = WideToUTF8(m_absPath); m_utf8RelPath = WideToUTF8(m_relPath); - m_hash = Hash(m_utf8RelPath); + m_utf8AuxInfo = WideToUTF8(m_auxInfo); + if (m_utf8AuxInfo.size()) + m_hash = Hash(m_utf8RelPath + '|' + m_utf8AuxInfo); + else + m_hash = Hash(m_utf8RelPath); #else - m_hash = Hash(m_relPath); + if (m_auxInfo.size()) + m_hash = Hash(m_relPath + '|' + m_auxInfo); + else + m_hash = Hash(m_relPath); #endif } #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,24 +125,24 @@ void ProjectPath::assign(const ProjectPath& parentPath, const SystemString& path #if HECL_UCS2 m_utf8AbsPath = WideToUTF8(m_absPath); m_utf8RelPath = WideToUTF8(m_relPath); - m_hash = Hash(m_utf8RelPath); + m_utf8AuxInfo = WideToUTF8(m_auxInfo); + if (m_utf8AuxInfo.size()) + m_hash = Hash(m_utf8RelPath + '|' + m_utf8AuxInfo); + else + m_hash = Hash(m_utf8RelPath); #else - m_hash = Hash(m_relPath); + if (m_auxInfo.size()) + m_hash = Hash(m_relPath + '|' + m_auxInfo); + else + m_hash = Hash(m_relPath); #endif } #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