diff --git a/gui/src/hkx/ResourceManager.cpp b/gui/src/hkx/ResourceManager.cpp index 15b6480..35ecc90 100644 --- a/gui/src/hkx/ResourceManager.cpp +++ b/gui/src/hkx/ResourceManager.cpp @@ -47,125 +47,127 @@ ResourceManager::ResourceManager(WorkspaceConfig& workspace) : scanWorkspace(); } - _charactersNames = _workspace.getCharacterProjects(); - for (auto& character : _charactersNames) + if (!_workspace.empty()) { - _characters.push_back(_workspace.getFolder() / character.toUtf8().constData()); - } + _charactersNames = _workspace.getCharacterProjects(); + for (auto& character : _charactersNames) + { + _characters.push_back(_workspace.getFolder() / character.toUtf8().constData()); + } - _miscellaneousNames = _workspace.getMiscellaneousProjects(); - for (auto& misc : _miscellaneousNames) - { - _miscellaneous.push_back(_workspace.getFolder() / misc.toUtf8().constData()); - } + _miscellaneousNames = _workspace.getMiscellaneousProjects(); + for (auto& misc : _miscellaneousNames) + { + _miscellaneous.push_back(_workspace.getFolder() / misc.toUtf8().constData()); + } - _esp = new Collection((char* const)_workspace.getFolder().string().c_str(), 3); + _esp = new Collection((char* const)_workspace.getFolder().string().c_str(), 3); - ModFlags masterFlags = ModFlags(0xA); - ModFile* skyrimMod = _esp->AddMod("creatures.esp", masterFlags); + ModFlags masterFlags = ModFlags(0xA); + ModFile* skyrimMod = _esp->AddMod("creatures.esp", masterFlags); - char* argvv[4]; - argvv[0] = new char(); - argvv[1] = new char(); - argvv[2] = new char(); - argvv[3] = new char(); - logger.init(4, argvv); + char* argvv[4]; + argvv[0] = new char(); + argvv[1] = new char(); + argvv[2] = new char(); + argvv[3] = new char(); + logger.init(4, argvv); - _esp->Load(); + _esp->Load(); - //find children classes; - hkDefaultClassNameRegistry& defaultRegistry = hkDefaultClassNameRegistry::getInstance(); - hkArray classes; - defaultRegistry.getClasses(classes); - for (int i = 0; i < classes.getSize(); ++i) - { - //bool isParent = false; - //for (int j = 0; j < classes.getSize(); ++j) + //find children classes; + hkDefaultClassNameRegistry& defaultRegistry = hkDefaultClassNameRegistry::getInstance(); + hkArray classes; + defaultRegistry.getClasses(classes); + for (int i = 0; i < classes.getSize(); ++i) + { + //bool isParent = false; + //for (int j = 0; j < classes.getSize(); ++j) + //{ + // if (classes[j]->getParent() == classes[i]) + // { + // isParent = true; + // break; + // } + //} + bool not_serializable = classes[i]->getFlags().allAreSet(hkClass::FLAGS_NOT_SERIALIZABLE); + if (!not_serializable) + _concreate_classes.push_back(classes[i]); + } + + //used to generate the Special members map + //std::set> interesting_members; + //std::set interesting_classes; + //for (int c = 0; c < _concreate_classes.size(); ++c) //{ - // if (classes[j]->getParent() == classes[i]) + // for (size_t i = 0; i < _concreate_classes[c]->getNumMembers(); ++i) { + // const auto& member_declaration = _concreate_classes[c]->getMember(i); + // if (member_declaration.getFlags().get() & hkClassMember::SERIALIZE_IGNORED) + // continue; + // switch (member_declaration.getType()) { + // case hkClassMember::TYPE_INT8: + // case hkClassMember::TYPE_UINT8: + // case hkClassMember::TYPE_INT16: + // case hkClassMember::TYPE_UINT16: + // case hkClassMember::TYPE_INT32: + // case hkClassMember::TYPE_UINT32: + // case hkClassMember::TYPE_INT64: + // case hkClassMember::TYPE_UINT64: + // interesting_classes.insert(std::string(_concreate_classes[c]->getName()) + "Class"); + // interesting_members.insert( + // { + // "&" + std::string(_concreate_classes[c]->getName()) + "Class", + // std::to_string(i), + // member_declaration.getName() + // } + // ); + // default: + // break; + // } + // } + //} + //ofstream myfile; + //myfile.open("int_class_members.txt"); + //for (auto& entry : interesting_classes) + //{ + // myfile << "extern const hkClass " << entry << ";" << std::endl; + //} + //myfile << std::endl; + //for (auto& entry : interesting_members) + //{ + // std::string guessed_type = "MemberIndexType::Invalid"; + // if ( + // entry[0].find("ragdoll") != string::npos || entry[0].find("Ragdoll") != string::npos || + // entry[2].find("ragdoll") != string::npos || entry[2].find("Ragdoll") != string::npos + // ) + // { + // guessed_type = "MemberIndexType::ragdollBoneIndex"; + // } + // else if ( + // entry[0].find("bone") != string::npos || entry[0].find("Bone") != string::npos || + // entry[2].find("bone") != string::npos || entry[2].find("Bone") != string::npos + // ) + // { + // guessed_type = "MemberIndexType::boneIndex"; + // } + // else if ( + // entry[0].find("event") != string::npos || entry[0].find("Event") != string::npos || + // entry[2].find("event") != string::npos || entry[2].find("Event") != string::npos + // ) // { - // isParent = true; - // break; + // guessed_type = "MemberIndexType::eventIndex"; // } + // else if ( + // entry[0].find("variable") != string::npos || entry[0].find("Variable") != string::npos || + // entry[2].find("variable") != string::npos || entry[2].find("Variable") != string::npos + // ) + // { + // guessed_type = "MemberIndexType::variableIndex"; + // } + // myfile << "\t{{" << entry[0] << "," << entry[1] << "}, " << guessed_type <<"}, //" << entry[2] << std::endl; //} - bool not_serializable = classes[i]->getFlags().allAreSet(hkClass::FLAGS_NOT_SERIALIZABLE); - if (!not_serializable) - _concreate_classes.push_back(classes[i]); - } - - //used to generate the Special members map - //std::set> interesting_members; - //std::set interesting_classes; - //for (int c = 0; c < _concreate_classes.size(); ++c) - //{ - // for (size_t i = 0; i < _concreate_classes[c]->getNumMembers(); ++i) { - // const auto& member_declaration = _concreate_classes[c]->getMember(i); - // if (member_declaration.getFlags().get() & hkClassMember::SERIALIZE_IGNORED) - // continue; - // switch (member_declaration.getType()) { - // case hkClassMember::TYPE_INT8: - // case hkClassMember::TYPE_UINT8: - // case hkClassMember::TYPE_INT16: - // case hkClassMember::TYPE_UINT16: - // case hkClassMember::TYPE_INT32: - // case hkClassMember::TYPE_UINT32: - // case hkClassMember::TYPE_INT64: - // case hkClassMember::TYPE_UINT64: - // interesting_classes.insert(std::string(_concreate_classes[c]->getName()) + "Class"); - // interesting_members.insert( - // { - // "&" + std::string(_concreate_classes[c]->getName()) + "Class", - // std::to_string(i), - // member_declaration.getName() - // } - // ); - // default: - // break; - // } - // } - //} - //ofstream myfile; - //myfile.open("int_class_members.txt"); - //for (auto& entry : interesting_classes) - //{ - // myfile << "extern const hkClass " << entry << ";" << std::endl; - //} - //myfile << std::endl; - //for (auto& entry : interesting_members) - //{ - // std::string guessed_type = "MemberIndexType::Invalid"; - // if ( - // entry[0].find("ragdoll") != string::npos || entry[0].find("Ragdoll") != string::npos || - // entry[2].find("ragdoll") != string::npos || entry[2].find("Ragdoll") != string::npos - // ) - // { - // guessed_type = "MemberIndexType::ragdollBoneIndex"; - // } - // else if ( - // entry[0].find("bone") != string::npos || entry[0].find("Bone") != string::npos || - // entry[2].find("bone") != string::npos || entry[2].find("Bone") != string::npos - // ) - // { - // guessed_type = "MemberIndexType::boneIndex"; - // } - // else if ( - // entry[0].find("event") != string::npos || entry[0].find("Event") != string::npos || - // entry[2].find("event") != string::npos || entry[2].find("Event") != string::npos - // ) - // { - // guessed_type = "MemberIndexType::eventIndex"; - // } - // else if ( - // entry[0].find("variable") != string::npos || entry[0].find("Variable") != string::npos || - // entry[2].find("variable") != string::npos || entry[2].find("Variable") != string::npos - // ) - // { - // guessed_type = "MemberIndexType::variableIndex"; - // } - // myfile << "\t{{" << entry[0] << "," << entry[1] << "}, " << guessed_type <<"}, //" << entry[2] << std::endl; - //} - //myfile.close(); - + //myfile.close(); + } } ResourceManager::~ResourceManager() @@ -1263,7 +1265,7 @@ QStringList ResourceManager::clipAnimationsList(int project_index) return out.toList(); } -QStringList ResourceManager::attackEventList(int project_index) +QStringList ResourceManager::eventList(int project_index, bool attacksOnly) { HKXWrapper wrap; QSet out; @@ -1287,13 +1289,18 @@ QStringList ResourceManager::attackEventList(int project_index) for (int e = 0; e < string_data->m_eventNames.getSize(); ++e) { QString eventName = string_data->m_eventNames[e].cString(); - if ( - eventName.startsWith("attackStart") || - eventName.startsWith("attackPowerStart") || - eventName.startsWith("bashStart") || - eventName.startsWith("bashPowerStart") - ) + if (attacksOnly) { + if (eventName.startsWith("attackStart") || + eventName.startsWith("attackPowerStart") || + eventName.startsWith("bashStart") || + eventName.startsWith("bashPowerStart") + ) + { + out << eventName; + } + } + else { out << eventName; } } diff --git a/gui/src/hkx/ResourceManager.h b/gui/src/hkx/ResourceManager.h index 6483c19..6562f0d 100644 --- a/gui/src/hkx/ResourceManager.h +++ b/gui/src/hkx/ResourceManager.h @@ -187,7 +187,7 @@ namespace ckcmd { QStringList assetsList(int project_index, AssetType type); QStringList clipList(int project_index); QStringList clipAnimationsList(int project_index); - QStringList attackEventList(int project_index); + QStringList eventList(int project_index, bool attacksOnly); QStringList wordVariableList(int project_index); /* CACHE SETS */ diff --git a/gui/src/main.cpp b/gui/src/main.cpp index 79e4826..e6db195 100644 --- a/gui/src/main.cpp +++ b/gui/src/main.cpp @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) return 1; // Error, for example } Settings.set("/general/workspace_folder", launcher._workspace_folder); - workspace_path = launcher._workspace_folder.toStdString(); + workspace_path = launcher._workspace_folder.toUtf8().constData(); } //Check if the workspace is empty diff --git a/gui/src/models/ProjectModel.cpp b/gui/src/models/ProjectModel.cpp index b8a0fea..c8ca4ce 100644 --- a/gui/src/models/ProjectModel.cpp +++ b/gui/src/models/ProjectModel.cpp @@ -575,23 +575,24 @@ QAbstractItemModel* ProjectModel::editModel(const QModelIndex& index, AssetType } else if (AssetType::events == type) { - auto top_behavior_index = getChildAssetProxy(index, NodeType::BehaviorHkxNode); - if (top_behavior_index.isValid()) - { - if (AssetType::events == type) - { - auto events_node = getChildAssetProxy(top_behavior_index, NodeType::behaviorEventNames); - if (events_node.isValid()) - return new SelectionProxyModel(this, events_node); - } - } - return nullptr; + //auto top_behavior_index = getChildAssetProxy(index, NodeType::BehaviorHkxNode); + //if (top_behavior_index.isValid()) + //{ + // if (AssetType::events == type) + // { + // auto events_node = getChildAssetProxy(top_behavior_index, NodeType::behaviorEventNames); + // if (events_node.isValid()) + // return new SelectionProxyModel(this, events_node); + // } + //} + //return nullptr; + return new StringListModel(_resourceManager.eventList(edge._project, false)); } else if (AssetType::variable_words == type) { return new StringListModel(_resourceManager.wordVariableList(edge._project)); } else if (AssetType::attack_events == type) { - return new StringListModel(_resourceManager.attackEventList(edge._project)); + return new StringListModel(_resourceManager.eventList(edge._project, true)); } else if (AssetType::clips == type) { return new StringListModel(_resourceManager.clipList(edge._project)); diff --git a/gui/src/widgets/TextureTool.cpp b/gui/src/widgets/TextureTool.cpp index 2ae62d3..92c7453 100644 --- a/gui/src/widgets/TextureTool.cpp +++ b/gui/src/widgets/TextureTool.cpp @@ -54,13 +54,14 @@ void TextureTool::on_folderLineEdit_textChanged(const QString& text) { _proxyModel->setFilterFixedString(pattern); nifView->expandAll(); + nifView->resizeColumnToContents(0); } ); nifView->setModel(_proxyModel.get()); nifView->setVisible(false); - nifView->resizeColumnToContents(0); nifView->expandAll(); + nifView->resizeColumnToContents(0); nifView->setVisible(true); connect(nifView->selectionModel(), &QItemSelectionModel::currentChanged, this, &TextureTool::on_nifView_selectionChanged); diff --git a/gui/src/widgets/TextureTool.ui b/gui/src/widgets/TextureTool.ui index 487d10f..4f84296 100644 --- a/gui/src/widgets/TextureTool.ui +++ b/gui/src/widgets/TextureTool.ui @@ -6,47 +6,36 @@ 0 0 - 1272 - 480 + 1011 + 464 Texture Tool - + - + - + - + + + Select Folder + + + + + - - - - - Select Folder - - - - - - - - - - - - ... - - - - - - + - + + + ... + + @@ -82,44 +71,26 @@ - - - - - - - - - QAbstractItemView::NoEditTriggers - - - QAbstractItemView::MultiSelection - - - Qt::ElideNone - - - false - - - false - - - false - - - - - - - - - - - - - - + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::MultiSelection + + + Qt::ElideNone + + + false + + + false + + + false + + diff --git a/src/core/AnimationCache.cpp b/src/core/AnimationCache.cpp index 16f919e..1d8e2ce 100644 --- a/src/core/AnimationCache.cpp +++ b/src/core/AnimationCache.cpp @@ -136,19 +136,22 @@ AnimationCache::AnimationCache(const fs::path& workspacePath) : } AnimationCache::AnimationCache(const fs::path& animationDataPath, const fs::path& animationSetDataPath) { - string animationDataContent; + if (fs::exists(animationDataPath) && fs::exists(animationSetDataPath)) { - std::ifstream t(animationDataPath.string()); - animationDataContent = string((std::istreambuf_iterator(t)), - std::istreambuf_iterator()); - } - string animationSetDataContent; - { - std::ifstream t(animationSetDataPath.string()); - animationSetDataContent = string((std::istreambuf_iterator(t)), - std::istreambuf_iterator()); + string animationDataContent; + { + std::ifstream t(animationDataPath.string()); + animationDataContent = string((std::istreambuf_iterator(t)), + std::istreambuf_iterator()); + } + string animationSetDataContent; + { + std::ifstream t(animationSetDataPath.string()); + animationSetDataContent = string((std::istreambuf_iterator(t)), + std::istreambuf_iterator()); + } + build(animationDataContent, animationSetDataContent); } - build(animationDataContent, animationSetDataContent); } AnimationCache::AnimationCache(const string& animationDataContent, const string& animationSetDataContent) {