Skip to content

Commit 2f79d74

Browse files
committed
Format all python files
1 parent d2a71de commit 2f79d74

File tree

16 files changed

+1990
-1013
lines changed

16 files changed

+1990
-1013
lines changed

BlenderUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import bpy
22

33

4-
def MessageBox(message="", title="Glacier Engine", icon='INFO'):
4+
def MessageBox(message="", title="Glacier Engine", icon="INFO"):
55
def draw(self, context):
66
self.layout.label(text=message)
77

8-
bpy.context.window_manager.popup_menu(draw, title=title, icon=icon)
8+
bpy.context.window_manager.popup_menu(draw, title=title, icon=icon)

__init__.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414
from . import file_borg
1515

1616

17-
from bpy.props import (BoolVectorProperty,
18-
PointerProperty,
19-
)
17+
from bpy.props import (
18+
BoolVectorProperty,
19+
PointerProperty,
20+
)
2021

21-
from bpy.types import (PropertyGroup,
22-
)
22+
from bpy.types import (
23+
PropertyGroup,
24+
)
2325

2426
# ------------------------------------------------------------------------
2527
# Scene Properties
2628
# ------------------------------------------------------------------------
2729

28-
class GlacierSettings(PropertyGroup):
2930

31+
class GlacierSettings(PropertyGroup):
3032
def show_lod_update(self, context):
31-
32-
mesh_obs = [o for o in bpy.context.scene.objects if o.type == 'MESH']
33+
mesh_obs = [o for o in bpy.context.scene.objects if o.type == "MESH"]
3334
for obj in mesh_obs:
34-
3535
should_show = False
3636
for bit in range(8):
3737
if self.show_lod[bit]:
@@ -43,11 +43,11 @@ def show_lod_update(self, context):
4343
return None
4444

4545
show_lod: BoolVectorProperty(
46-
name='show_lod',
47-
description='Set which LOD levels should be shown',
46+
name="show_lod",
47+
description="Set which LOD levels should be shown",
4848
default=(True, True, True, True, True, True, True, True),
4949
size=8,
50-
subtype='LAYER',
50+
subtype="LAYER",
5151
update=show_lod_update,
5252
)
5353

@@ -56,11 +56,11 @@ def show_lod_update(self, context):
5656
# Panels
5757
# ------------------------------------------------------------------------
5858
class GLACIER_PT_settingsPanel(bpy.types.Panel):
59-
bl_idname = 'GLACIER_PT_settingsPanel'
60-
bl_space_type = 'VIEW_3D'
61-
bl_region_type = 'UI'
62-
bl_category = 'Glacier'
63-
bl_label = 'Settings'
59+
bl_idname = "GLACIER_PT_settingsPanel"
60+
bl_space_type = "VIEW_3D"
61+
bl_region_type = "UI"
62+
bl_category = "Glacier"
63+
bl_label = "Settings"
6464

6565
def draw(self, context):
6666
glacier_settings = context.scene.glacier_settings
@@ -69,24 +69,25 @@ def draw(self, context):
6969
layout.label(text="show LOD:")
7070

7171
row = layout.row(align=True)
72-
for i, name in enumerate(["high", " ", " ", " ", " ", " ", " ", "low"]):
72+
for i, name in enumerate(
73+
["high", " ", " ", " ", " ", " ", " ", "low"]
74+
):
7375
row.prop(glacier_settings, "show_lod", index=i, text=name, toggle=True)
7476

77+
7578
# ------------------------------------------------------------------------
7679
# Registration
7780
# ------------------------------------------------------------------------
7881

79-
classes = [
80-
GlacierSettings,
81-
GLACIER_PT_settingsPanel
82-
]
82+
classes = [GlacierSettings, GLACIER_PT_settingsPanel]
8383

8484
modules = [
8585
file_prim,
8686
# file_mjba, # WIP module. enable at own risk
87-
file_borg
87+
file_borg,
8888
]
8989

90+
9091
def register():
9192
from bpy.utils import register_class
9293

@@ -107,7 +108,7 @@ def unregister():
107108

108109
for cls in classes:
109110
unregister_class(cls)
110-
111+
111112
del bpy.types.Scene.glacier_settings
112113

113114

file_aloc/format.py

Lines changed: 83 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import sys
44
import ctypes
55

6+
67
class PhysicsDataType(enum.IntEnum):
78
NONE = 0
89
CONVEX_MESH = 1
@@ -11,12 +12,14 @@ class PhysicsDataType(enum.IntEnum):
1112
PRIMITIVE = 4
1213
CONVEX_MESH_AND_PRIMITIVE = 5
1314
TRIANGLE_MESH_AND_PRIMITIVE = 6
14-
15+
16+
1517
class PhysicsCollisionType(enum.IntEnum):
1618
NONE = 0
1719
STATIC = 1
1820
RIGIDBODY = 2
1921

22+
2023
class PhysicsCollisionLayerType(enum.IntEnum):
2124
COLLIDE_WITH_ALL = 0
2225
STATIC_COLLIDABLES_ONLY = 1
@@ -50,66 +53,126 @@ class PhysicsCollisionLayerType(enum.IntEnum):
5053
AI_VISION_BLOCKER_AMBIENT_ONLY = 29
5154
UNUSED_LAST = 30
5255

56+
5357
class PhysicsCollisionPrimitiveType(enum.IntEnum):
5458
BOX = 0
5559
CAPSULE = 1
5660
SPHERE = 2
5761

62+
5863
class PhysicsCollisionSettings(ctypes.Structure):
5964
_fields_ = [
6065
("data_type", ctypes.c_uint32),
6166
("collider_type", ctypes.c_uint32),
6267
]
6368

69+
6470
class Physics:
6571
def __init__(self):
6672
self.data_type = PhysicsDataType.NONE
6773
self.collision_type = PhysicsCollisionType.NONE
68-
if not os.environ['PATH'].startswith(os.path.abspath(os.path.dirname(__file__))):
69-
os.environ['PATH'] = os.path.abspath(os.path.dirname(__file__)) + os.pathsep + os.environ['PATH']
70-
self.lib = ctypes.CDLL(os.path.abspath(os.path.join(os.path.dirname(__file__), "alocgen.dll")), winmode=0)
71-
self.lib.AddConvexMesh.argtypes = (ctypes.c_uint32, ctypes.POINTER(ctypes.c_float), ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32), ctypes.c_uint64,)
74+
if not os.environ["PATH"].startswith(
75+
os.path.abspath(os.path.dirname(__file__))
76+
):
77+
os.environ["PATH"] = (
78+
os.path.abspath(os.path.dirname(__file__))
79+
+ os.pathsep
80+
+ os.environ["PATH"]
81+
)
82+
self.lib = ctypes.CDLL(
83+
os.path.abspath(os.path.join(os.path.dirname(__file__), "alocgen.dll")),
84+
winmode=0,
85+
)
86+
self.lib.AddConvexMesh.argtypes = (
87+
ctypes.c_uint32,
88+
ctypes.POINTER(ctypes.c_float),
89+
ctypes.c_uint32,
90+
ctypes.POINTER(ctypes.c_uint32),
91+
ctypes.c_uint64,
92+
)
7293
self.lib.AddConvexMesh.restype = ctypes.c_int
73-
self.lib.AddTriangleMesh.argtypes = (ctypes.c_uint32, ctypes.POINTER(ctypes.c_float), ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32), ctypes.c_uint64,)
94+
self.lib.AddTriangleMesh.argtypes = (
95+
ctypes.c_uint32,
96+
ctypes.POINTER(ctypes.c_float),
97+
ctypes.c_uint32,
98+
ctypes.POINTER(ctypes.c_uint32),
99+
ctypes.c_uint64,
100+
)
74101
self.lib.AddTriangleMesh.restype = ctypes.c_int
75-
self.lib.AddPrimitiveBox.argtypes = (ctypes.POINTER(ctypes.c_float), ctypes.c_uint64, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),)
102+
self.lib.AddPrimitiveBox.argtypes = (
103+
ctypes.POINTER(ctypes.c_float),
104+
ctypes.c_uint64,
105+
ctypes.POINTER(ctypes.c_float),
106+
ctypes.POINTER(ctypes.c_float),
107+
)
76108
self.lib.AddPrimitiveBox.restype = ctypes.c_int
77-
self.lib.AddPrimitiveCapsule.argtypes = (ctypes.c_float, ctypes.c_float, ctypes.c_uint64, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),)
109+
self.lib.AddPrimitiveCapsule.argtypes = (
110+
ctypes.c_float,
111+
ctypes.c_float,
112+
ctypes.c_uint64,
113+
ctypes.POINTER(ctypes.c_float),
114+
ctypes.POINTER(ctypes.c_float),
115+
)
78116
self.lib.AddPrimitiveCapsule.restype = ctypes.c_int
79-
self.lib.AddPrimitiveSphere.argtypes = (ctypes.c_float, ctypes.c_uint64, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float),)
117+
self.lib.AddPrimitiveSphere.argtypes = (
118+
ctypes.c_float,
119+
ctypes.c_uint64,
120+
ctypes.POINTER(ctypes.c_float),
121+
ctypes.POINTER(ctypes.c_float),
122+
)
80123
self.lib.AddPrimitiveSphere.restype = ctypes.c_int
81-
self.lib.SetCollisionSettings.argtypes = (ctypes.POINTER(PhysicsCollisionSettings),)
124+
self.lib.SetCollisionSettings.argtypes = (
125+
ctypes.POINTER(PhysicsCollisionSettings),
126+
)
82127
self.lib.SetCollisionSettings.restype = ctypes.c_int
83128
self.lib.NewPhysics()
84129

85130
def write(self, filepath):
86131
self.lib.Write(filepath)
87-
132+
88133
def set_collision_settings(self, settings):
89134
self.lib.SetCollisionSettings(ctypes.byref(settings))
90135

91136
def add_convex_mesh(self, vertices_list, indices_list, collider_layer):
92137
vertices = (ctypes.c_float * len(vertices_list))(*vertices_list)
93138
indices = (ctypes.c_uint32 * len(indices_list))(*indices_list)
94-
self.lib.AddConvexMesh(len(vertices_list), vertices, int(len(indices_list) / 3), indices, collider_layer)
95-
139+
self.lib.AddConvexMesh(
140+
len(vertices_list),
141+
vertices,
142+
int(len(indices_list) / 3),
143+
indices,
144+
collider_layer,
145+
)
146+
96147
def add_triangle_mesh(self, vertices_list, indices_list, collider_layer):
97148
vertices = (ctypes.c_float * len(vertices_list))(*vertices_list)
98149
indices = (ctypes.c_uint32 * len(indices_list))(*indices_list)
99-
self.lib.AddTriangleMesh(len(vertices_list), vertices, int(len(indices_list) / 3), indices, collider_layer)
150+
self.lib.AddTriangleMesh(
151+
len(vertices_list),
152+
vertices,
153+
int(len(indices_list) / 3),
154+
indices,
155+
collider_layer,
156+
)
100157

101-
def add_primitive_box(self, half_extents_list, collider_layer, position_list, rotation_list):
158+
def add_primitive_box(
159+
self, half_extents_list, collider_layer, position_list, rotation_list
160+
):
102161
half_extents = (ctypes.c_float * len(half_extents_list))(*half_extents_list)
103162
position = (ctypes.c_float * len(position_list))(*position_list)
104163
rotation = (ctypes.c_float * len(rotation_list))(*rotation_list)
105164
self.lib.AddPrimitiveBox(half_extents, collider_layer, position, rotation)
106-
107-
def add_primitive_capsule(self, radius, length, collider_layer, position_list, rotation_list):
165+
166+
def add_primitive_capsule(
167+
self, radius, length, collider_layer, position_list, rotation_list
168+
):
108169
position = (ctypes.c_float * len(position_list))(*position_list)
109170
rotation = (ctypes.c_float * len(rotation_list))(*rotation_list)
110171
self.lib.AddPrimitiveCapsule(radius, length, collider_layer, position, rotation)
111-
112-
def add_primitive_sphere(self, radius, collider_layer, position_list, rotation_list):
172+
173+
def add_primitive_sphere(
174+
self, radius, collider_layer, position_list, rotation_list
175+
):
113176
position = (ctypes.c_float * len(position_list))(*position_list)
114177
rotation = (ctypes.c_float * len(rotation_list))(*rotation_list)
115-
self.lib.AddPrimitiveSphere(radius, collider_layer, position, rotation)
178+
self.lib.AddPrimitiveSphere(radius, collider_layer, position, rotation)

0 commit comments

Comments
 (0)