-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.lua
56 lines (42 loc) · 1.72 KB
/
models.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
52
53
54
55
56
-- MODULE MODELS.LUA
-- by Garran Plum
--
-- Functions that process .fbx model files.
--
-- FUNCTION ASSIGNMENTS
-- IMPORT GP OBJECT
local myMod, GP = ...
-- GP FUNCTION Register Model Files
-- Register all model files in config.models.
-- FUNCTIONAL, GAME EFFECT CALL
function GP:registerModelFiles()
-- Sugar for GP:config()
local config = GP:config()
-- Sugar for config.modelFiles
local modelFiles = config.modelFiles
for modelFile, categoryKeyArray in pairs(modelFiles) do
local modelFileName =
GP:magicWords().model.folder .. "/" .. modelFile ..
GP:magicWords().model.extension
-- Register prefabs for each category in the file.
for index, categoryKey in ipairs(categoryKeyArray) do
-- Get a list of parts for the category.
local categoryPartsList = config.categories[categoryKey]
-- Register all prefabs in the category.
GP:registerCategoryPrefabs(modelFileName, categoryKey, config)
end
-- Register one asset processor for the entire file.
GP.mod:registerAssetProcessor(modelFileName, {
DataType = GP:datatypes().building.processor,
})
-- Register all attach node types in entire mod.
GP:registerAttachNodeTypes(config)
-- Register all path nodes, path types, and building parts for each category.
for index, categoryKey in ipairs(categoryKeyArray) do
-- Get a list of parts for the category.
local categoryPartsList = config.categories[categoryKey]
-- Register all path nodes and types to all parts in the category.
GP:registerPartPaths(modelFileName, categoryKey, config)
end
end
end