feat: update BMap bindings
- add testbench file in BMap bindings. - reorganise BMap bindings code. - write some BMapSharp binding code.
This commit is contained in:
3
BMapBindings/PyBMap/.gitignore
vendored
3
BMapBindings/PyBMap/.gitignore
vendored
@ -9,9 +9,6 @@
|
||||
*.dylib
|
||||
*.bin
|
||||
|
||||
# Ignore testbench file.
|
||||
testbench.py
|
||||
|
||||
# -------------------- Python --------------------
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
@ -1,7 +1,7 @@
|
||||
# PyBMap
|
||||
|
||||
The real scripts are placed in sub PyBMap folder. This folder is served for testbench scripts placing. Place any testbench files (e.g. `testbench.py`) in there what you want and don't sumbit them (`testbench.py` is explicitly excluded by gitignore file).
|
||||
The real scripts are placed in sub PyBMap folder. This folder is served for testbench scripts placing. You can run `testbench.py` to do a basic test for PyBMap but you may need some essential files to run this testbench which were written in `testbench.py`.
|
||||
|
||||
The native BMap library should be placed in sub PyBMap folder, and I have used gitignore file to filter them. The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), or `BMap.dylib` (in macOS). If you still can not load BMap or your system is not listed above, you should name it as `BMap.bin`.
|
||||
|
||||
Please note the most content of `virtools_types.py` are generated by EnumsMigration sub-project, so if some structs are updated, do not forget checking this file. Additionally the whole `bmap.py` is generated by BMapBindings, if something need to be changed, please modify the template of BMapBindings and do not midify the result directly.
|
||||
Please note the most content of `virtools_types.py` are generated by EnumsMigration sub-project. Additionally the most content of `bmap.py` is generated by BMapBindings. So if some structs are updated, do not forget checking these files.
|
||||
|
35
BMapBindings/PyBMap/testbench.py
Normal file
35
BMapBindings/PyBMap/testbench.py
Normal file
@ -0,0 +1,35 @@
|
||||
import os
|
||||
import PyBMap.bmap_wrapper as bmap
|
||||
|
||||
def main() -> None:
|
||||
input(f'Python PID is {os.getpid()}. Waiting for debugger, press any key to continue...')
|
||||
|
||||
file_name: str = 'Level_02.NMO'
|
||||
temp_folder: str = 'Temp'
|
||||
texture_folder: str = 'F:\\Ballance\\Ballance\\Textures'
|
||||
encodings: tuple[str, ...] = ('cp1252', )
|
||||
with bmap.BMFileReader(file_name, temp_folder, texture_folder, encodings) as reader:
|
||||
print('===== Groups =====')
|
||||
for gp in reader.get_groups():
|
||||
print(gp.get_name())
|
||||
|
||||
print('===== Objects =====')
|
||||
for obj in reader.get_3dobjects():
|
||||
print(obj.get_name())
|
||||
|
||||
print('===== Meshes =====')
|
||||
for mesh in reader.get_meshs():
|
||||
print(mesh.get_name())
|
||||
|
||||
print('===== Materials =====')
|
||||
for mtl in reader.get_materials():
|
||||
print(mtl.get_name())
|
||||
|
||||
print('===== Textures =====')
|
||||
for tex in reader.get_textures():
|
||||
print(tex.get_name())
|
||||
|
||||
print('===== END =====')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Reference in New Issue
Block a user