Commit 399acee3 authored by Mats391's avatar Mats391
Browse files

Fix hierachy when importing colmesh

parent a83a4a23
......@@ -101,7 +101,7 @@ fn ReadGeomCol fp fileversion =
-- reads geom subs
fn ReadGeomSub fp fileversion geomnode =
fn ReadGeomSub fp fileversion geompart =
(
-- number of geom cols (4 bytes)
local colnum = ReadLong fp
......@@ -112,7 +112,7 @@ fn ReadGeomSub fp fileversion geomnode =
-- create dummy
local nonvisroot = Dummy()
nonvisroot.name = "nonvis_"
nonvisroot.parent = geomnode
nonvisroot.parent = geompart
-- col data
for j=1 to colnum do
......@@ -151,8 +151,7 @@ fn ImportColMesh filename =
local meshname = getFilenameFile filename
-- create root node
local rootnode = Dummy()
rootnode.name = "root_" + meshname
local rootnode = bf2Utils.makeL -1 ("root_bundledmesh_" + meshname)
-- file info (8 bytes)
local head = ReadLong fp
......@@ -160,13 +159,38 @@ fn ImportColMesh filename =
-- chunknum (4 bytes)
local geomnum = ReadLong fp
-- create the geoms
local geom0 = bf2Utils.makeT rootnode "geom0"
local geom0lod0 = bf2Utils.makeT geom0 "lod0"
local geom1 = bf2Utils.makeT rootnode "geom1"
local geom1lod0 = bf2Utils.makeT geom1 "lod0"
local geom2 = bf2Utils.makeT rootnode "geom2"
local geom2lod0 = bf2Utils.makeT geom2 "lod0"
-- geoms (? bytest)
for i=1 to geomnum do
for i=0 to geomnum - 1 do
(
local geomnode = Dummy()
geomnode.name = "geom" + ((i-1) as string)
geomnode.parent = rootnode
local partNumber
if i < 10 then
partNumber = "0" + (i as string)
else
partNumber = i as string
local geom0Part = bf2Utils.makeB geom0lod0 ("part_" + partNumber)
--geom0Part.Scale = [0.1,0.1,0.1]
local geom1Part = bf2Utils.makeB geom1lod0 ("part_" + partNumber)
--geom1Part.Scale = [0.1,0.1,0.1]
local geom2Part = bf2Utils.makeB geom2lod0 ("part_" + partNumber)
--geom2Part.Scale = [0.1,0.1,0.1]
-- subgeomnum (4 bytes)
local subgeomnum = ReadLong fp
......@@ -174,7 +198,18 @@ fn ImportColMesh filename =
-- subgeoms (? bytes)
for j=1 to subgeomnum do
(
ReadGeomSub fp fileversion geomnode
if j == 1 do
(
ReadGeomSub fp fileversion geom0part
)
if j == 2 do
(
ReadGeomSub fp fileversion geom1part
)
if j == 3 do
(
ReadGeomSub fp fileversion geom2part
)
)
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment