Skip to content

Commit

Permalink
Fixed import model surface error.
Browse files Browse the repository at this point in the history
  • Loading branch information
AiMiDi committed Feb 8, 2022
1 parent 9323072 commit b00cd28
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 35 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
/release

sdk_r20/frameworks/
sdk_s22/frameworks/
sdk_r21/frameworks/
sdk_r23/frameworks/
sdk_s24/frameworks/
sdk_r25/frameworks/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,12 @@ If there is a problem with selecting multiple-parts when the model is imported,
4. Optimize import speed and stability.
5. Fixed import normal inversion problem for versions below R23.

**version 0.4.5.1** Fixed import model surface error.

## Author

AiMiDi

[![](https://img.shields.io/badge/-@AiMiDi-%23181717?style=flat-square&logo=github)](https://github.com/AiMiDi)

[![](https://img.shields.io/badge/-%40艾米蒂aimidi-blue?style=flat-square&logo=bilibili)](https://space.bilibili.com/30898053)
[![](https://img.shields.io/badge/-%40艾米蒂aimidi-blue?style=flat-square&logo=bilibili)](https://space.bilibili.com/30898053)
2 changes: 2 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ Cinema 4D的mmdtool。
4. 优化导入速度,稳定性。
5. 修复R23以下版本导入法线反转问题。

**version 0.4.5.1** 修复导入模型面错误的问题。

## 作者

AiMiDi
Expand Down
1 change: 0 additions & 1 deletion sdk_r20/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
frameworks/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
1 change: 0 additions & 1 deletion sdk_r21/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
frameworks/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
1 change: 0 additions & 1 deletion sdk_r23/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
frameworks/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
1 change: 0 additions & 1 deletion sdk_r25/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
frameworks/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "maxon/ioconnection.h"
#include "maxon/iostreams.h"
#include "maxon/datetime.h"
#include "maxon/iobrowse.h"
#include "maxon/iostreams.h"
#include "maxon/ioconnection.h"
#include "maxon/url.h"
Binary file modified sdk_r25/frameworks/core.framework/generated/parsed/maxon/url.ph
Binary file not shown.
Binary file removed sdk_r25/plugins/mmdtool/mmdtool.xdl64
Binary file not shown.
2 changes: 0 additions & 2 deletions sdk_r25/plugins/mmdtool/mmdtool.xdl64.manifest

This file was deleted.

4 changes: 4 additions & 0 deletions sdk_r25/plugins/mmdtool/res/c4d_symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ enum
IDS_MES_CONFIRM_DELETE_FILE,
IDS_MES_CANNOT_DELETE_DEFAULT,

IDS_MES_IMPORT_MOD_OK,
IDS_MES_IMPORT_MOD_INFO_A,
IDS_MES_IMPORT_MOD_INFO_B,

IDS_MES_BONE_MORPH_DELETE,
IDS_MES_DELETE_ALL_ANIM,
IDS_MES_DELETE_BONE_ANIM,
Expand Down
2 changes: 1 addition & 1 deletion sdk_r25/plugins/mmdtool/res/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ PMX_MOD_IMPORT_WEIGHTS: true
PMX_MOD_IMPORT_IK: true
PMX_MOD_IMPORT_INHERIT: true
PMX_MOD_IMPORT_EXPRESSION: true
PMX_MOD_IMPORT_MULTIPART: false
PMX_MOD_IMPORT_MULTIPART: true
PMX_MOD_IMPORT_ENGLISH: false
PMX_MOD_IMPORT_ENGLISH_CHECK: false
7 changes: 4 additions & 3 deletions sdk_r25/plugins/mmdtool/res/description/TMMDBone.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
enum
{
PMX_BONE_INFO_GRP = 10000,
PMX_BONE_INDEX_TEXT,
PMX_BONE_INDEX,
PMX_BONE_NAME_LOCAL,//骨骼本地名称
PMX_BONE_NAME_UNIVERSAL,//骨骼通用名称
Expand Down Expand Up @@ -64,6 +63,8 @@ enum
PMX_BONE_MORPH_ADD_NAME,
PMX_BONE_MORPH_ADD_BUTTON,

PMX_BONE_INDEX_TEXT,

PMX_BONE_TAG_XCURVE = 0,
PMX_BONE_TAG_YCURVE = 1,
PMX_BONE_TAG_ZCURVE = 2,
Expand All @@ -73,8 +74,8 @@ enum
PMX_BONE_NAME_IS_LOCAL = 0,//骨骼使用本地名称
PMX_BONE_NAME_IS_UNIVERSAL = 1,//骨骼使用通用名称

PMX_BONE_TAIL_IS_INDEX = 0,//是连接子骨骼
PMX_BONE_TAIL_IS_POSITION = 1,//是连接相对位置
PMX_BONE_TAIL_IS_POSITION = 0,//是连接子骨骼
PMX_BONE_TAIL_IS_INDEX = 1,//是连接相对位置

};
#endif _PMX_BONE_TAG_H_
8 changes: 6 additions & 2 deletions sdk_r25/plugins/mmdtool/res/strings_en-US/c4d_strings.str
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ STRINGTABLE
IDS_MES_SELECT_ERR "Please select an object";

IDS_MES_IMPORT_ERR "Import failed:";
IDS_MES_IMPORT_TYPE_ERR "File is not a vmd file";
IDS_MES_IMPORT_TYPE_ERR "File is not a # file";
IDS_MES_IMPORT_READ_ERR "Cannot read file";
IDS_MES_IMPORT_CAM_ERR "It's not a camera VMD file";
IDS_MES_IMPORT_MOD_ERR "It's not a model VMD file";
Expand All @@ -23,14 +23,18 @@ STRINGTABLE
IDS_MES_CONVER_ERR "Conversion failed:";
IDS_MES_CONVER_TYPE_ERR "The selected object is not a camera.";

IDS_MES_IMPORT_MOT_OK "Successfully imported # bone's and # morph's # Frame(s) at # ms!";
IDS_MES_IMPORT_MOT_OK "Successfully imported animation: # bone's and # morph's # Frame(s) at # ms!";
IDS_MES_IMPORT_MOT_CF_BONE "Can't find # bone(s)";
IDS_MES_IMPORT_MOT_CF_MORPH "Can't find # morph(s)";

IDS_MES_INQUIRY_OVERWRITING_FILE "Do you want to overwrite the file?";
IDS_MES_CONFIRM_DELETE_FILE "Do you want to delete all animations of the selected model?";
IDS_MES_CANNOT_DELETE_DEFAULT "The default configuration file cannot be deleted!";

IDS_MES_IMPORT_MOD_OK "Successfully imported model:Name: #Comment:#English name: #English comment:#";
IDS_MES_IMPORT_MOD_INFO_A "Vertex Count: #Surface Count: #Texture Count: #Material Count: #";
IDS_MES_IMPORT_MOD_INFO_B "Bone Count: #Morph Count: #Use time: # ms";

IDS_MES_BONE_MORPH_DELETE "Do you want to delete # bone morph?";
IDS_MES_DELETE_ALL_ANIM "Do you want to delete all the animation data of the model?";
IDS_MES_DELETE_BONE_ANIM "Do you want to delete all the bone animation data of the model?";
Expand Down
5 changes: 4 additions & 1 deletion sdk_r25/plugins/mmdtool/res/strings_zh-CN/c4d_strings.str
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ STRINGTABLE {
IDS_MES_OPEN_FILE_ERR "\u65e0\u6cd5\u6253\u5f00\u6587\u4ef6";
IDS_MES_SELECT_ERR "\u8bf7\u9009\u62e9\u4e00\u4e2a\u5bf9\u8c61";
IDS_MES_IMPORT_ERR "\u5bfc\u5165\u5931\u8d25:";
IDS_MES_IMPORT_TYPE_ERR "\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u662fvmd\u6587\u4ef6\uff01";
IDS_MES_IMPORT_TYPE_ERR "\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u662f # \u6587\u4ef6\uff01";
IDS_MES_IMPORT_READ_ERR "\u4e0d\u80fd\u8bfb\u53d6\u6587\u4ef6\uff01";
IDS_MES_IMPORT_CAM_ERR "\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u662f\u6444\u50cf\u673a\u52a8\u4f5c\u6587\u4ef6\uff01";
IDS_MES_IMPORT_MOD_ERR "\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u662f\u6a21\u578b\u52a8\u4f5c\u6587\u4ef6";
Expand All @@ -23,6 +23,9 @@ STRINGTABLE {
IDS_MES_INQUIRY_OVERWRITING_FILE "\u6587\u4ef6\u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f";
IDS_MES_CONFIRM_DELETE_FILE "\u662f\u5426\u8981\u5220\u9664 # \u914d\u7f6e\u6587\u4ef6\uff1f";
IDS_MES_CANNOT_DELETE_DEFAULT "\u4e0d\u80fd\u5220\u9664\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\uff01";
IDS_MES_IMPORT_MOD_OK "\u6210\u529f\u5bfc\u5165\u6a21\u578b:\u540d\u79f0: #\u8bf4\u660e:#\u82f1\u6587\u540d\u79f0: #\u82f1\u6587\u8bf4\u660e:#";
IDS_MES_IMPORT_MOD_INFO_A "\u9876\u70b9\u6570: #\u9762\u6570: #\u8d34\u56fe\u6570: #\u6750\u8d28\u6570: #";
IDS_MES_IMPORT_MOD_INFO_B "\u9aa8\u9abc\u6570: #\u8868\u60c5\u6570: #\u4f7f\u7528\u65f6\u95f4: # ms";
IDS_MES_BONE_MORPH_DELETE "\u662f\u5426\u786e\u5b9a\u8981\u5220\u9664 # \u9aa8\u9abc\u8868\u60c5\uff1f";
IDS_MES_DELETE_ALL_ANIM "\u662f\u5426\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u6a21\u578b\u7684\u6240\u6709\u52a8\u753b\uff1f";
IDS_MES_DELETE_BONE_ANIM "\u662f\u5426\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u6a21\u578b\u7684\u6240\u6709\u9aa8\u9abc\u52a8\u753b\uff1f";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ STRINGTABLE TMMDBone
{
TMMDBone "MMD \u9aa8\u9abc\u6807\u7b7e";
PMX_BONE_INFO_GRP "MMD \u9aa8\u9abc\u4fe1\u606f";
PMX_BONE_INDEX_TEXT " \u9aa8\u9abc\u7d22\u5f15 ";
PMX_BONE_INDEX_TEXT " \u9aa8\u9abc\u7d22\u5f15 ";
PMX_BONE_INDEX "";
PMX_BONE_NAME_LOCAL "\u9aa8\u9abc\u672c\u5730\u540d\u79f0(\u548c)";
PMX_BONE_NAME_UNIVERSAL "\u9aa8\u9abc\u901a\u7528\u540d\u79f0(\u82f1)";
Expand Down
1 change: 0 additions & 1 deletion sdk_s22/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
frameworks/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
1 change: 0 additions & 1 deletion sdk_s24/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
frameworks/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
22 changes: 6 additions & 16 deletions source/MMD_PMX_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1765,29 +1765,23 @@ namespace mmd {
}
#if API_VERSION >= 23000
g_spinlock.Lock();
part_polygon[surface_index].a = vertex_a_index;
part_polygon[surface_index].b = vertex_b_index;
part_polygon[surface_index].c = vertex_c_index;
part_polygon[surface_index] = CPolygon(vertex_a_index, vertex_b_index, vertex_c_index);
g_spinlock.Unlock();
#else
g_spinlock.Lock();
part_polygon[surface_index].a = vertex_c_index;
part_polygon[surface_index].b = vertex_b_index;
part_polygon[surface_index].c = vertex_a_index;
part_polygon[surface_index] = CPolygon(vertex_c_index, vertex_b_index, vertex_a_index);
g_spinlock.Unlock();
#endif
if (this->m_import_settings.import_normal)
{
Vector normal0 = (Vector)vertex0.normal;
Vector normal1 = (Vector)vertex1.normal;
Vector normal2 = (Vector)vertex2.normal;
Vector normal3(0, 0, 0);
Vector normal2 = (Vector)vertex2.normal;
normal0.Normalize();
normal1.Normalize();
normal2.Normalize();
normal3.Normalize();
g_spinlock.Lock();
NormalTag::Set(normal_handle, surface_index, NormalStruct(normal0, normal1, normal2, normal3));
NormalTag::Set(normal_handle, surface_index, NormalStruct(normal0, normal1, normal2, Vector(0, 0, 0)));
g_spinlock.Unlock();
}
if (this->m_import_settings.import_uv)
Expand Down Expand Up @@ -2398,18 +2392,14 @@ namespace mmd {
PMXVertexData& vertex1 = this->m_vertex_data[surface.b];
PMXVertexData& vertex2 = this->m_vertex_data[surface.c];
g_spinlock.Lock();
model_polygon[surface_index].a = surface.a;
model_polygon[surface_index].b = surface.b;
model_polygon[surface_index].c = surface.c;
model_polygon[surface_index] = CPolygon(surface.a, surface.b, surface.c);
g_spinlock.Unlock();
#else
PMXVertexData& vertex0 = this->m_vertex_data[surface.c];
PMXVertexData& vertex1 = this->m_vertex_data[surface.b];
PMXVertexData& vertex2 = this->m_vertex_data[surface.a];
g_spinlock.Lock();
model_polygon[surface_index].a = surface.c;
model_polygon[surface_index].b = surface.b;
model_polygon[surface_index].c = surface.a;
model_polygon[surface_index] = CPolygon(surface.c, surface.b, surface.a);
g_spinlock.Unlock();
#endif
if (this->m_import_settings.import_normal)
Expand Down

0 comments on commit b00cd28

Please sign in to comment.