Skip to content

Commit

Permalink
doc: modify document to mark changes
Browse files Browse the repository at this point in the history
- add universal encoding infos in documentation.
- bump up version to 4.1 for release.
  • Loading branch information
yyc12345 committed Sep 21, 2024
1 parent c8d59ef commit c894d88
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bbp_ng/blender_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ schema_version = "1.0.0"
# Example of manifest file for a Blender extension
# Change the values according to your extension
id = "bbp_ng"
version = "4.0.0"
version = "4.1.0"
name = "Ballance Blender Plugin"
tagline = "The specialized add-on served for creating game map of Ballance"
maintainer = "yyc12345 <[email protected]>"
Expand Down
17 changes: 10 additions & 7 deletions docs/docs/en/import-export-virtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ The default values for the options in the Conflict Options section are the solut

It is well known that Virtools uses a system-based multi-byte character encoding to process documents, and is therefore prone to what is known as garbling; Blender itself does not suffer from garbling, however, if we do not read a Virtools document with the correct encoding, the characters stored in it may still appear garbled when the Virtools document is imported into Blender. The Encodings property in the Virtools Params section specifies the encodings for reading Virtools documents. Multiple encodings can be specified, separated by a `;` (semicolon). Some common encodings are listed below:

* 1252 (Windows only): Western European encoding used by Ballance.
* 936 (Windows only): the default encoding for Chinese Windows system.
* CP1252 (non-Windows): Western European encoding used by Ballance.
* CP936 (non-Windows): the default encoding for Chinese Windows system.
* cp1252: Western European encoding used by Ballance.
* gb2312: The default encoding for Chinese Windows system.

The encoding attribute is very important, if you set the wrong encoding, the names of the various objects imported into Blender will be unrecognizable.
The encoding attribute is very important. If the wrong encoding is set, the names of the various objects imported into Blender will be unrecognizable, or will cause the program to make an error.

!!! warning "Encoding is a platform dependent setting"
According to the implementation of LibCmo, the underlying library used by BBP's Virtools documentation for the import module, the encoding attribute is a platform dependent setting. Under Windows, the [Windows Code Page](https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers) number is required here. Under other operating systems, LibCmo uses iconv for character encoding and decoding, so you need to use the legal [Iconv Encoding Identifier](https://www.gnu.org/software/libiconv/).
!!! info "What encodings are available?"
Since BBP version 4.1, the names of the encodings we use are basically just copied from the Python encoding names. Most of the commonly used encoding names in Most of the commonly used encoding names in Python are mapped, with only a few particularly rare encodings unsupported, and for specific supported encodings it is necessary to check the source code. See [Python documentation](https://docs.python.org/3/library/codecs.html#standard-encodings) for information on Python's supported encodings. Encodings are not case-sensitive.

!!! warning "Warning about migration from older versions"
Starting with BBP version 4.1, the version number of LibCmo, the underlying library used by BBP's Virtools document import module, has been bumped to 0.2. Before this version, the encoding attribute was a platform-dependent setting. Under Windows, the [Windows Code Page](https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers) number is required here. Under other operating systems, LibCmo uses iconv for character encoding decoding, so the legal [iconv encoding identifier](hhttps://www.gnu.org/software/libiconv/) is required.

This all changed with LibCmo 0.2, from which LibCmo uses Python-like universal encoding names. It is platform-independent, you no longer need to check whether the operating system you are using is Windows or Linux, the encoded characters are the same string for all platforms. This also means that if you have customized your encoding settings before, you need to be careful to convert them to the new universal encoding name, because the old encoding name may not have a corresponding mapping under the universal encoding name system, for example, `1252` specified on Windows before should be written as `cp1252` under the new universal encoding name, and the original encoding name won't be recognized correctly on the new system.

## Export Virtools File

Expand Down
17 changes: 10 additions & 7 deletions docs/docs/zh-cn/import-export-virtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ Conflict Options(冲突解决选项)章节指示了当导入器遇到物体

众所周知,Virtools使用基于系统的多字节字符编码来处理文档,因而很容易出现所谓乱码问题。Blender本身不会出现乱码问题,然而如果我们不能以正确的编码读取Virtools文档,则当Virtools文档被导入Blender时,其中存储的字符仍然可能会呈现乱码状态。Virtools Params(Virtools参数)章节的Encodings(编码)属性用于指定读取Virtools文档的编码。可以指定多个编码,多个编码之间用`;`(分号)分隔。下面列出一些常用的编码:

* 1252(Windows下):Ballance所用的西欧编码
* 936(Windows下):中文Windows系统默认编码
* CP1252(非Windows下):Ballance所用的西欧编码
* CP936(非Windows下):中文默认编码
* cp1252:Ballance所用的西欧编码
* gb2312:中文Windows系统默认编码

编码属性非常重要,如果设置了错误的编码,导入Blender的各类物体的名称会出现不可认知的情况。
编码属性非常重要,如果设置了错误的编码,导入Blender的各类物体的名称会出现不可认知的情况,又或者会导致程序出错

!!! warning "编码是一个平台相关的设定"
根据BBP的Virtools文档导入模块使用的底层库LibCmo的实现,编码属性是一个平台相关的设定。在Windows下,这里需要填写的是[Windows代码页](https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers)数字。而在其它操作系统下,LibCmo使用iconv进行字符编码解码,因此需要使用合法的[iconv编码标识符](https://www.gnu.org/software/libiconv/)
!!! info "有哪些编码可以使用?"
自BBP 4.1版本后,我们使用编码的名字基本上就是照抄Python的编码名。大多数Python中常用的编码名都有映射,只有一些特别罕见的编码没有支持,对于具体支持的编码则需要查看源码。有关Python支持的编码,请查看[Python相关文档](https://docs.python.org/3/library/codecs.html#standard-encodings)。编码名不区分大小写。

!!! warning "从旧版本迁移的警告"
自BBP 4.1版本开始,BBP的Virtools文档导入模块使用的底层库LibCmo版本号提升为0.2。在此版本前,编码属性是一个平台相关的设定。在Windows下,这里需要填写的是[Windows代码页](https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers)数字。而在其它操作系统下,LibCmo使用iconv进行字符编码解码,因此需要使用合法的[iconv编码标识符](https://www.gnu.org/software/libiconv/)

这一切在LibCmo 0.2后发生了改变,从这个版本开始,LibCmo采用了类似Python的统一编码名。它是平台无关的,你不再需要检查你正在使用的操作系统是Windows还是Linux,所有平台的编码字符均为相同的字符串。这也就意味着如果您之前自定义过编码设置,你需要注意将他们转换到新的统一编码名,因为旧的编码名可能在统一编码名下没有对应映射,例如之前在Windows上指定的`1252`,在新的统一编码名下应当被书写为`cp1252`,原编码在新系统下无法被正确识别。

## 导出Virtools文档

Expand Down

0 comments on commit c894d88

Please sign in to comment.