Skip to content

Commit

Permalink
2.0RC5
Browse files Browse the repository at this point in the history
  • Loading branch information
Puiching-Memory committed Dec 1, 2023
1 parent bd6eb7e commit 66734fc
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 281 deletions.
Binary file modified __pycache__/objloadN.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/output.cpython-310.pyc
Binary file not shown.
28 changes: 0 additions & 28 deletions analyze.py

This file was deleted.

2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
del Object

print("正在导出文件:", outfile_name + ".schem")
out = output.SchemN(data[0],data[1],data[2])
out = output.SchemN(*data)
out.Exp_sch(outfile_name)

35 changes: 29 additions & 6 deletions objloadN.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ def _analyze(self):
continue


print(self.child[0].get())
#print(self.child[0].get())

def get_pixel(self,img_index:int,x_scale:float,y_scale:float):
#print(img_index)
data = self.child[img_index].get_colour(self.child[img_index].get_map_size()[0] * x_scale,self.child[img_index].get_map_size()[1] * y_scale)
return data


class mtlC:
Expand Down Expand Up @@ -185,9 +190,12 @@ def get(self) -> list:
self.map_y,
self.map_obj,
]

def get_map_size(self):
return (self.map_x,self.map_y)

def get_colour(self, x, y) -> list:
pass
#print('x',x,'y',y)
return self.map_obj.getpixel((round(x,0)-1,round(y,0)-1))


class OBJN:
Expand Down Expand Up @@ -225,7 +233,8 @@ def Exp_V(self) -> list:
list[1] = vn_list #法向量列表\n
list[2] = vt_list #uv列表\n
list[3] = f_list #面列表\n
list[4] = mtllib #mtl文件对象
list[4] = mtllib #mtl文件对象\n
list[5] = strc #f分组结构
"""
if self._enc_data == []:
raise IndexError("导出错误:数据未载入,先调用Open(path)")
Expand All @@ -235,6 +244,7 @@ def Exp_V(self) -> list:
_exp_f = []
_exp_vt = []
_exp_mtllib = mtlN()
_exp_strc = []

for i in track(self._enc_data, description="分析点v数据"):
# 使用正则表达式提取以"v"开头的行
Expand Down Expand Up @@ -284,12 +294,25 @@ def Exp_V(self) -> list:
except Exception as error:
print(error)

return [_exp_v, _exp_vn, _exp_vt, _exp_f, _exp_mtllib]
strc_count = 0
#_exp_strc.append('D')
for i in track(self._enc_data, description="分析usemtl结构"):
if str(i).startswith('f'):
strc_count = strc_count + 1
continue

if str(i).startswith('usemtl'):
_exp_strc.append(strc_count)
#_exp_strc.append('M')
strc_count = 0
_exp_strc.append(strc_count)

return [_exp_v, _exp_vn, _exp_vt, _exp_f, _exp_mtllib,_exp_strc]


if __name__ == "__main__":
Object = OBJN()
Object.Open("3dobj/tex/tex.obj")
#Object.Open("2E.obj")
result = Object.Exp_V()
#print(result)
print(result[5])
245 changes: 0 additions & 245 deletions objloader.py

This file was deleted.

Loading

0 comments on commit 66734fc

Please sign in to comment.