UnrealCodeAnalyzer 是一款多功能工具链,可对 Unreal Engine 和自定义代码库进行全面分析。它提供了丰富强大的分析工具,如代码搜索、API 文档生成、子系统分析等,能有效提升代码分析和管理的效率。
git clone https://github.com/yourusername/unreal-code-analyzer.git
cd unreal-code-analyzer
npm install
config.json 文件以指定代码库路径和其他选项。node index.js --analyze-classes AActor,APawn
git clone https://github.com/yourusername/unreal-code-analyzer.git
cd unreal-code-analyzer
npm install
config.json 文件以指定代码库路径和其他选项。const analyzer = new UnrealCodeAnalyzer({
// 必填:设置 Unreal Engine 路径或自定义代码库路径
codebasePath: '/path/to/unreal/engine',
// 可选:启用详细日志记录
verbose: true,
// 可选:指定要分析的模块或组件(按逗号分隔)
modules: ['Physics', 'Rendering']
});
const docGenerator = new DocumentationGenerator(analyzer);
docGenerator.generate('/path/to/output/docs');
const parser = new CodeParser();
parser.parseFile('/path/to/source/file.cpp');
const classAnalysis = analyzer.analyzeClass('AMyActor');
// 输出: {
// name: 'AMyActor',
// hierarchy: ['AActor', 'APawn'],
// properties: [...],
// functions: [...],
// comments: [...]
// }
const searchResults = analyzer.searchCode({
query: 'UE4.*_STRUCT',
options: {
caseSensitive: true,
regex: false
}
});
const physicsSubsystem = analyzer.analyzeSubsystem('Physics');
// 输出: 包含物理系统的详细组件和功能模块的结构报告。
const regexSearch = analyzer.searchWithRegex(/\bUE4_\w+_STRUCT\b/g);
// 输出匹配结果
test('应正确分析 Actor 类', () => {
const analyzer = new UnrealCodeAnalyzer({ codebasePath: '/' });
const result = analyzer.analyzeClass('AActor');
expect(result.hierarchy).toContain('AActor');
});
node docs/generate.js --path /path/to/engine --output ./docs
在 package.json 中添加以下内容:
{
"scripts": {
"generate-docs": "doc-generator --config config.json"
}
}
node src/index.js --help
node src/index.js --analyze AMyActor,AMyOtherActor
config.json 中添加 customCodebasePath 属性,或在初始化时通过选项传递。codebasePath。codebasePath 到配置文件或直接传递给构造函数。我们欢迎任何形式的贡献,包括功能增强、bug 修复和文档更新。
推荐以下学习资料以深入理解 Unreal Engine 的内部机制:
unreal-code-analyzer/
├── src/ # 源代码目录
│ ├── Analyzer.js # 主分析器类
│ ├── CodeParser.js # 语法解析器
│ └── DocumentationGenerator.js # 文档生成工具
├── docs/ # 文档和示例
├── test/ # 单元测试文件
└── package.json # 项目依赖管理
本项目遵循 MIT 协议。欢迎 fork 和贡献。