├── RenderdocResourceExporter
├── fbx_res
│ ├── __init__.py
│ ├── libfbxsdk.dll
│ ├── RenderdocCSVToFBX.exe
│ ├── RenderdocCSVToFBX
│ │ ├── RenderdocCSVToFBX
│ │ │ ├── CommonMath.cpp
│ │ │ ├── CommonMath.h
│ │ │ ├── FileStream.cpp
│ │ │ ├── FileStream.h
│ │ │ ├── RenderdocCSVToFBX.vcxproj.user
│ │ │ ├── RenderdocCSVToFBX.vcxproj.filters
│ │ │ ├── CSVFile.h
│ │ │ ├── RenderdocCSVToFBX.vcxproj
│ │ │ ├── RenderdocCSVToFBX.cpp
│ │ │ ├── unchecked.h
│ │ │ ├── core.h
│ │ │ ├── checked.h
│ │ │ └── CSVFile.cpp
│ │ └── RenderdocCSVToFBX.sln
│ ├── csv_to_fbx.bat
│ ├── mesh_to_csv.py
│ ├── csv_to_fbx.py
│ ├── fbx_export_option_dialog_const_mapper.py
│ └── fbx_export_option_dialog.py
├── qt_utilities
│ ├── __init__.py
│ ├── setting_utility.py
│ ├── root_const_mapper.py
│ └── progress_bar_utility.py
├── extension.json
└── __init__.py
├── .gitignore
├── install.bat
├── README.md
└── LICENSE
/RenderdocResourceExporter/fbx_res/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/qt_utilities/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore python
2 | __pycache__/
3 |
4 | # ignore c++
5 | .vs/
6 | x64/
7 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/libfbxsdk.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rrtt2323/RenderdocResourceExporter/HEAD/RenderdocResourceExporter/fbx_res/libfbxsdk.dll
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rrtt2323/RenderdocResourceExporter/HEAD/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX.exe
--------------------------------------------------------------------------------
/install.bat:
--------------------------------------------------------------------------------
1 | set src=RenderdocResourceExporter
2 |
3 | set dst=%APPDATA%\qrenderdoc\extensions\%src%
4 | if not exist "%dst%" mkdir "%dst%"
5 | xcopy "%~dp0%src%\*" "%dst%" /i /e /Y /C
6 |
7 | ::pause
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/CommonMath.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rrtt2323/RenderdocResourceExporter/HEAD/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/CommonMath.cpp
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/CommonMath.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rrtt2323/RenderdocResourceExporter/HEAD/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/CommonMath.h
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/FileStream.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rrtt2323/RenderdocResourceExporter/HEAD/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/FileStream.cpp
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/FileStream.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rrtt2323/RenderdocResourceExporter/HEAD/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/FileStream.h
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/csv_to_fbx.bat:
--------------------------------------------------------------------------------
1 | :: 用来调用 RenderdocCSVToFBX.exe 的批处理文件
2 |
3 | ::cd /d %~dp0
4 | set current_path=%~dp0
5 |
6 | echo current_path=%current_path%
7 | start %current_path%RenderdocCSVToFBX.exe %1 %2 %3 %4 %5 %6
8 |
9 | ::pause
10 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/RenderdocCSVToFBX.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/extension.json:
--------------------------------------------------------------------------------
1 | {
2 | "extension_api": 1,
3 | "name": "Renderdoc Resource Exporter",
4 | "version": "1.0",
5 | "minimum_renderdoc": "1.2",
6 | "description": "Used to export the resources captured by Renderdoc \n-------------------------------- \n用于导出 Renderdoc 捕获的资源",
7 | "author": "rrtt_2323 ",
8 | "url": "https://github.com/rrtt2323/RenderdocResourceExporter"
9 | }
--------------------------------------------------------------------------------
/RenderdocResourceExporter/qt_utilities/setting_utility.py:
--------------------------------------------------------------------------------
1 | '''
2 | 配置文件实用工具
3 | '''
4 |
5 | import os, tempfile
6 |
7 | from PySide2 import QtWidgets, QtCore, QtGui
8 |
9 | class SettingUtility:
10 |
11 | @staticmethod
12 | def get_tempdir_setting(iniName):
13 | path = os.path.join(tempfile.gettempdir(), iniName)
14 | settings = QtCore.QSettings(path, QtCore.QSettings.IniFormat)
15 | return path, settings
16 | pass
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RenderdocResourceExporter
2 | The main feature is to export renderdoc captured mesh.
3 | Because I don't want to export csv and then convert it to fbx in other software.
4 | So I wrote this thing.
5 |
6 | C++ code modified from https://github.com/chineseoldghost/csv2fbx
7 |
8 | install:
9 |
10 | 
11 | 
12 |
13 | use:
14 |
15 | 
16 |
17 | ---
18 |
19 | 主要功能是导出renderdoc捕获的mesh。
20 | 因为我不想先导出csv,然后到别的软件中去转换成fbx。
21 | 所以我写了这个东西。
22 |
23 | c++代码修改自 https://github.com/chineseoldghost/csv2fbx
24 |
25 | 安装,使用见上图
26 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32630.192
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderdocCSVToFBX", "RenderdocCSVToFBX\RenderdocCSVToFBX.vcxproj", "{32B66845-400B-47AD-A69F-4A52CDAC7CB1}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Debug|x64.ActiveCfg = Debug|x64
17 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Debug|x64.Build.0 = Debug|x64
18 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Debug|x86.ActiveCfg = Debug|Win32
19 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Debug|x86.Build.0 = Debug|Win32
20 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Release|x64.ActiveCfg = Release|x64
21 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Release|x64.Build.0 = Release|x64
22 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Release|x86.ActiveCfg = Release|Win32
23 | {32B66845-400B-47AD-A69F-4A52CDAC7CB1}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {97F1C158-FEEB-4820-A8AD-3FFE496350C5}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/mesh_to_csv.py:
--------------------------------------------------------------------------------
1 | '''
2 | mesh 数据导出为 CSV 文件
3 | '''
4 |
5 | import os, csv, sys
6 | from pathlib import Path
7 |
8 | from PySide2 import QtWidgets, QtCore, QtGui
9 |
10 | current_folder = Path(__file__).absolute().parent
11 | father_folder = str(current_folder.parent)
12 | sys.path.append(father_folder)
13 |
14 | from qt_utilities.progress_bar_utility import ProgressBarUtility
15 |
16 |
17 | class MeshToCsv:
18 |
19 | emgr = None
20 |
21 | def __init__(self, emgr_):
22 | self.emgr = emgr_
23 | pass
24 |
25 | def execute(self, table_, save_path_):
26 |
27 | # 先把旧的删掉
28 | if os.path.exists(save_path_):
29 | os.remove(save_path_)
30 |
31 | model = table_.model()
32 | row_count = model.rowCount()
33 | column_count = model.columnCount()
34 | rows = range(row_count)
35 | columns = range(column_count)
36 |
37 | head_names = list()
38 | row_data_list = list()
39 |
40 | for _, c_i in ProgressBarUtility.loop(columns, status_='Collect mesh data'):
41 | head = model.headerData(c_i, QtCore.Qt.Horizontal)
42 | row_data = [model.data(model.index(r_i, c_i)) for r_i in rows]
43 |
44 | head_names.append(head)
45 | row_data_list.append(row_data)
46 |
47 | with open(save_path_, "w", newline='') as csvFile:
48 | writer = csv.writer(csvFile)
49 | writer.writerow(head_names)
50 |
51 | for _, r_i in ProgressBarUtility.loop(rows, status_='Write to the csv file'):
52 | write_data = list()
53 | for row_data in row_data_list:
54 | row_item = row_data[r_i]
55 | write_data.append(row_item)
56 | writer.writerow(write_data)
57 |
58 | pass
59 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/csv_to_fbx.py:
--------------------------------------------------------------------------------
1 | '''
2 | CSV 文件导出成 FBX 文件
3 | '''
4 |
5 | import os
6 | import sys
7 | from pathlib import Path
8 |
9 | current_folder = Path(__file__).absolute().parent
10 | father_folder = str(current_folder.parent)
11 | sys.path.append(father_folder)
12 |
13 | from qt_utilities.setting_utility import SettingUtility
14 | from fbx_res.fbx_export_option_dialog_const_mapper import FbxExportOptionDialogConstMapper as FCM
15 |
16 |
17 | class CsvToFbx:
18 |
19 | emgr = None
20 |
21 | def __init__(self, emgr_):
22 | self.emgr = emgr_
23 | pass
24 |
25 | def get_arg(self, config_, key_):
26 | if config_.get(key_):
27 | return '1'
28 | else:
29 | return '0'
30 | pass
31 |
32 | def execute(self, csv_path_, fbx_path_, export_config_):
33 |
34 | # 先把旧的删掉
35 | if os.path.exists(fbx_path_):
36 | os.remove(fbx_path_)
37 |
38 | # 读取设置
39 | export_normal = self.get_arg(export_config_, FCM.c_export_normal)
40 | export_tangent = self.get_arg(export_config_, FCM.c_export_tangent)
41 | export_uv = self.get_arg(export_config_, FCM.c_export_uv)
42 | export_uv2 = self.get_arg(export_config_, FCM.c_export_uv2)
43 | export_uv3 = self.get_arg(export_config_, FCM.c_export_uv3)
44 |
45 | # 拼接bat路径
46 | current_folder = Path(__file__).absolute()
47 | bat_path = str(current_folder.parent) + '\\csv_to_fbx.bat'
48 |
49 | # 运行参数格式化
50 | args = "%s %s %s %s %s %s %s " % (bat_path, csv_path_, export_normal, export_tangent, export_uv, export_uv2, export_uv3)
51 | # 通过执行命令行脚本来执行exe文件
52 | result = os.system(args)
53 |
54 | if result == 1:
55 | self.emgr.ErrorDialog('csv_to_fbx.bat return 1')
56 |
57 | pass
58 |
59 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/RenderdocCSVToFBX.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 | 源文件
23 |
24 |
25 | 源文件
26 |
27 |
28 | 源文件
29 |
30 |
31 |
32 |
33 | 头文件
34 |
35 |
36 | 头文件
37 |
38 |
39 | 头文件
40 |
41 |
42 | 头文件
43 |
44 |
45 | 头文件
46 |
47 |
48 | 头文件
49 |
50 |
51 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/fbx_export_option_dialog_const_mapper.py:
--------------------------------------------------------------------------------
1 | '''
2 | FBX 导出选项设置窗 - 常量管理器
3 | '''
4 |
5 | import sys
6 | from pathlib import Path
7 |
8 | current_folder = Path(__file__).absolute().parent
9 | father_folder = str(current_folder.parent)
10 | sys.path.append(father_folder)
11 |
12 | from qt_utilities.root_const_mapper import RootConstMapper
13 | from qt_utilities.setting_utility import SettingUtility
14 |
15 |
16 | class FbxExportOptionDialogConstMapper:
17 |
18 | # key值
19 | c_dialog_title = 'dialog_title'
20 | c_language = 'language'
21 | c_cancel = 'cancel'
22 | c_ok = 'ok'
23 |
24 | c_export_normal = 'export_normal'
25 | c_export_tangent = 'export_tangent'
26 | c_export_uv = 'export_uv'
27 | c_export_uv2 = 'export_uv2'
28 | c_export_uv3 = 'export_uv3'
29 |
30 | # 文本字典
31 | text_en = {
32 | c_dialog_title : 'FBX Export Option',
33 | c_language : 'Language',
34 | c_cancel : 'Cancel',
35 | c_ok : 'Ok',
36 |
37 | c_export_normal : 'Export Normal',
38 | c_export_tangent : 'Export Tangent',
39 | c_export_uv : 'Export UV',
40 | c_export_uv2 : 'Export UV2',
41 | c_export_uv3 : 'Export UV3',
42 | }
43 | text_cn = {
44 | c_dialog_title : 'FBX导出选项',
45 | c_language : '语言',
46 | c_cancel : '取消',
47 | c_ok : '确定',
48 |
49 | c_export_normal : '导出法线',
50 | c_export_tangent : '导出切线',
51 | c_export_uv : '导出 UV',
52 | c_export_uv2 : '导出 UV2',
53 | c_export_uv3 : '导出 UV3',
54 | }
55 |
56 | @staticmethod
57 | def get_text(key_):
58 | path, settings = SettingUtility.get_tempdir_setting(RootConstMapper.setting_preference)
59 |
60 | language = settings.value(RootConstMapper.c_language)
61 |
62 | if language == RootConstMapper.c_cn:
63 | return FbxExportOptionDialogConstMapper.text_cn[key_]
64 | else:
65 | return FbxExportOptionDialogConstMapper.text_en[key_]
66 |
67 | pass
68 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/qt_utilities/root_const_mapper.py:
--------------------------------------------------------------------------------
1 | '''
2 | 根 - 常量管理器
3 | '''
4 |
5 | import sys
6 | from pathlib import Path
7 |
8 | # 切换到上一层目录,以便导入父目录的模块
9 | current_folder = Path(__file__).absolute().parent
10 | father_folder = str(current_folder.parent)
11 | sys.path.append(father_folder)
12 |
13 | from qt_utilities.setting_utility import SettingUtility
14 |
15 |
16 | class RootConstMapper:
17 |
18 | setting_preference = 'renderdoc_resource_exporter_preference.ini'
19 |
20 | c_language = 'language'
21 | c_en = 'en'
22 | c_cn = 'cn'
23 |
24 | c_welcome_1 = 'welcome_1'
25 | c_welcome_2 = 'welcome_2'
26 | c_export_fbx = 'export_fbx'
27 | c_save_fbx_file_to = 'save_fbx_file_to'
28 | c_save_path_error = 'save_path_error'
29 | c_not_mesh_data = 'not_mesh_data'
30 | c_export_complete = 'export_complete'
31 |
32 | text_en = {
33 | c_welcome_1 : 'The resource exporter was registered successfully.',
34 | c_welcome_2 : 'Hey! Cowboy!',
35 | c_export_fbx : 'Export FBX',
36 | c_save_fbx_file_to : 'Save FBX File To',
37 | c_save_path_error : 'Save Path Error!!!',
38 | c_not_mesh_data : 'Not Mesh Data!!!',
39 | c_export_complete : 'Export complete. The save location then opens automatically.',
40 | }
41 | text_cn = {
42 | c_welcome_1 : '资源导出器注册成功',
43 | c_welcome_2 : '嘿!牛仔!',
44 | c_export_fbx : '导出FBX',
45 | c_save_fbx_file_to : '保存FBX文件到',
46 | c_save_path_error : '保存路径错误!!!',
47 | c_not_mesh_data : '没有网格数据!!!',
48 | c_export_complete : '导出完成。自动打开保存位置。',
49 | }
50 |
51 | @staticmethod
52 | def get_text(key_):
53 | path, settings = SettingUtility.get_tempdir_setting(RootConstMapper.setting_preference)
54 |
55 | language = settings.value(RootConstMapper.c_language)
56 |
57 | if language == RootConstMapper.c_cn:
58 | return RootConstMapper.text_cn[key_]
59 | else:
60 | return RootConstMapper.text_en[key_]
61 |
62 | pass
63 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/qt_utilities/progress_bar_utility.py:
--------------------------------------------------------------------------------
1 | '''
2 | 进度条实用工具
3 | '''
4 |
5 | from PySide2 import QtWidgets, QtCore, QtGui
6 |
7 |
8 | class ProgressBarUtility(QtWidgets.QProgressDialog):
9 |
10 | #构造函数
11 | def __init__(self,
12 | status_ = u"progress...",
13 | button_text_ = u"Cancel",
14 | minimum_ = 0,
15 | maximum_ = 100,
16 | parent_ = None,
17 | title_ = "",
18 | ):
19 | super(ProgressBarUtility, self).__init__(parent_)
20 |
21 | self.setWindowFlags(self.windowFlags())
22 | self.setWindowModality(QtCore.Qt.WindowModal)
23 | self.setWindowTitle(status_ if title_ else title_)
24 |
25 | bar = QtWidgets.QProgressBar(self)
26 | bar.setStyleSheet(
27 | """
28 | QProgressBar {
29 | color:white;
30 | border: 1px solid black;
31 | background: gray;
32 | }
33 |
34 | QProgressBar::chunk {
35 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,
36 | stop: 0 #78d,
37 | stop: 0.4999 #46a,
38 | stop: 0.5 #45a,
39 | stop: 1 #238 );
40 | border: 1px solid black;
41 | }
42 | """
43 | )
44 | bar.setAlignment(QtCore.Qt.AlignCenter)
45 |
46 | self.setBar(bar)
47 | self.setLabelText(status_)
48 | self.setCancelButtonText(button_text_)
49 | self.setRange(minimum_, maximum_)
50 | self.setValue(minimum_)
51 |
52 | # NOTE show the progressbar without blocking
53 | self.show()
54 | QtWidgets.QApplication.processEvents()
55 |
56 |
57 | #补充构造函数
58 | @classmethod
59 | def loop(cls, seq_, **kwargs_):
60 | self = cls(**kwargs_)
61 |
62 | #如果参数里没有规定最大值,就用序列的长度
63 | if not kwargs_.get("maximum"):
64 | self.setMaximum(len(seq_))
65 |
66 | for i, item in enumerate(seq_, 1):
67 | if self.wasCanceled():
68 | break
69 | try:
70 | yield i, item # with body executes here
71 | except:
72 | import traceback
73 | traceback.print_exc()
74 | self.deleteLater()
75 | self.setValue(i)
76 |
77 | self.deleteLater()
78 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/__init__.py:
--------------------------------------------------------------------------------
1 | '''
2 | 资源导出插件的入口类
3 | '''
4 |
5 | import os
6 |
7 | import qrenderdoc as qrd
8 | from PySide2 import QtWidgets, QtCore, QtGui
9 |
10 | from .qt_utilities.root_const_mapper import RootConstMapper as RCM
11 |
12 | from .fbx_res.fbx_export_option_dialog import FbxExportOptionDialog
13 | from .fbx_res.mesh_to_csv import MeshToCsv
14 | from .fbx_res.csv_to_fbx import CsvToFbx
15 |
16 |
17 | # 注册入口
18 | def register(version_, pyrenderdoc_):
19 | emgr = pyrenderdoc_.Extensions()
20 |
21 | emgr.MessageDialog(RCM.get_text(RCM.c_welcome_1), RCM.get_text(RCM.c_welcome_2))
22 |
23 | if pyrenderdoc_.HasMeshPreview():
24 | emgr.RegisterPanelMenu(qrd.PanelMenu.MeshPreview, [RCM.get_text(RCM.c_export_fbx)], ExportFbx)
25 |
26 |
27 | # 异常捕获
28 | def error_log(func_):
29 | def wrapper(pyrenderdoc, data):
30 | emgr = pyrenderdoc.Extensions()
31 | try:
32 | func_(pyrenderdoc, data)
33 | except:
34 | import traceback
35 | exc = traceback.format_exc()
36 | emgr.ErrorDialog(exc, "Error!!!")
37 |
38 | return wrapper
39 |
40 | # 导出fbx
41 | @error_log
42 | def ExportFbx(pyrenderdoc_, data_):
43 | emgr = pyrenderdoc_.Extensions()
44 |
45 | dialog = FbxExportOptionDialog(emgr) # 进行导出配置
46 | if not dialog.mqt.ShowWidgetAsDialog(dialog.init_ui()): return # 是不是主动取消的
47 |
48 | # 选择保存位置
49 | fbx_save_path = emgr.SaveFileName(RCM.get_text(RCM.c_save_fbx_file_to), '', '*.fbx')
50 | if not fbx_save_path:
51 | emgr.ErrorDialog(RCM.get_text(RCM.c_save_path_error), 'Error!!!')
52 | return
53 | # csv的地址
54 | csv_save_path = fbx_save_path.replace('.fbx', '.csv')
55 |
56 | # 直接从 QTableView 界面获取数据
57 | main_window = pyrenderdoc_.GetMainWindow().Widget()
58 | table = main_window.findChild(QtWidgets.QTableView, 'inTable')
59 | model = table.model()
60 | row_count = model.rowCount()
61 | column_count = model.columnCount()
62 | rows = range(row_count)
63 | columns = range(column_count)
64 | if len(rows) <=1 and len(columns) <= 2:
65 | emgr.ErrorDialog(RCM.get_text(RCM.c_not_mesh_data), 'Error!!!')
66 | return
67 |
68 | # 导出CSV数据表
69 | meshToCsv = MeshToCsv(emgr)
70 | pyrenderdoc_.Replay().BlockInvoke(meshToCsv.execute(table, csv_save_path))
71 | # 读取CSV文件,导出FBX文件
72 | if os.path.exists(csv_save_path):
73 | csvToFbx = CsvToFbx(emgr)
74 | pyrenderdoc_.Replay().BlockInvoke(csvToFbx.execute(csv_save_path, fbx_save_path, dialog.export_config))
75 |
76 | emgr.MessageDialog(RCM.get_text(RCM.c_export_complete), '\(^o^)/')
77 |
78 | # 打开保存位置
79 | fbx_dir = os.path.dirname(fbx_save_path)
80 | if os.path.exists(fbx_dir):
81 | os.startfile(fbx_dir)
82 |
83 |
--------------------------------------------------------------------------------
/RenderdocResourceExporter/fbx_res/RenderdocCSVToFBX/RenderdocCSVToFBX/CSVFile.h:
--------------------------------------------------------------------------------
1 | #ifndef CSVFILE_H_INCLUDE
2 | #define CSVFILE_H_INCLUDE
3 |
4 | #include
5 | #include
6 | #include