目标
在上一篇博客《从源代码编译Blender》中我成功地建立起了一个可以编译Blender源代码的VS工程。
从VS的“解决方案资源管理”中可以看到,其中有很多“项目”:
每一个“项目”都对应一个vcxproj
文件,可以看作是一个模块。
而这样的模块 又被放在了若干“文件夹”(filter)中。这可以看作是若干分类。
本篇的目标是:
- 根据官方文档的说明,简单了解模块的大致分类
参考文档:
模块分类
“分类”的层级关系以及它所包含的模块数量如下:
其中:
- 最上面的
CMakePredefinedTargets
中应该是为编译所服务的一些内容。 - 最下面的“其他模块”暂时还不了解。只知道其中的blender.vcxproj是当前的“启动项目”。(我猜测这一部分属于偏上层的模块)
- 因此,重点是中间三个大分类:
extern
、intern
、source
。
extern(External Library Code,外部库)
This directory contains source-code imported from other projects and not apart of Blender (strictly speaking).
Each library is stand-alone and typically included because they aren’t common system libraries we can rely on the system providing (such aslibjpeg
,zlib
andlibc
).
这里面包含了从其他项目导入的源文件,严格意义上讲并不属于Blender。
每一个库都是独立的。导入它们是因为他们并不是系统常见的库,对于系统常见的库我们可以依赖系统所提供(如libjpeg
、zlib
和libc
)
intern(Internal Library Code,内部库)
This directory contains source-code maintained by Blender developers but kept as isolated modules/libraries.
Some of these modules are C-API’s to libraries written in C++, since much of Blender’s core is written in C and can’t call into C++ code directly.
这里面的源代码是Blender开发者维护的,但是保持为独立的模块/库。
有些库是用C++写的,但是导出了C形式的接口。因为Blender的核心是用C写的,不能直接调用C++的代码。
source(Application Code,应用层)
Main source code directory for code maintained by Blender developers.
Blender开发者所维护的主要源代码目录
在其下有:
editors
Graphical editor code, tools, UI … (most of the interesting code is in there)
编辑器界面的代码,工具,UI等。大多数有趣的代码都在这里
imbuf
Image buffer API and functions (loading, writing and manipulating different image formats); seq just has it’s own buffer structure, but the loading is still done by imbuf; imbuf also has code for loading textures into openGL for display and all that
图像缓冲API和函数(读取,写入,操作不同的图像格式)。seq just has it’s own buffer structure,但是“读取”仍然由imbuf完成; imbuf还具有用于将纹理加载到openGL中进行显示的代码
io
看起来是一些3D格式的输入输出:
makesdna
DNA structures definition: All data structures that are saved into files are here
DNA结构体定义。保存到文件中的所有数据结构都在这里。
makesrna
RNA definitions and functions. Sits on top of DNA to provide a low level data access and definition API
RNA定义和函数。在DNA之上,提供底层数据的访问和API定义。
python
Python API, source files that embed the Python scripting language into Blender, as well as the API’s Blender exposes which are written in C.
See: Python API Reference.
将Python脚本嵌入到Blender中的源代码,和一些Blender中用C写的暴露为Python的接口。