Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position is now a vector in SR actors #212

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions dread_editor/level_data_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def render_scale(self, value):
def open_actor_link(self, link: str):
if (actor := self.bmsld.follow_link(link)) is not None:
layer_name = link.split(":")[4]
print(actor)
self.visible_actors[(layer_name, actor.sName)] = True

def render_actor_context_menu(self, layer_index: int, actor):
Expand All @@ -120,15 +119,13 @@ def render_actor_context_menu(self, layer_index: int, actor):

imgui.text("Position:")
imgui.same_line()
changed_x, x = imgui.slider_float("##actor-context-position-x", actor.x,
changed_x, x = imgui.slider_float("##actor-context-position-x", actor.positon[0],
self.display_borders["left"], self.display_borders["right"])
imgui.same_line()
changed_y, y = imgui.slider_float("##actor-context-position-y", actor.y,
changed_y, y = imgui.slider_float("##actor-context-position-y", actor.positon[1],
self.display_borders["top"], self.display_borders["bottom"])
if changed_x:
actor.x = x
if changed_y:
actor.y = y
if changed_x or changed_y:
actor.positon = (x, y, actor.positon[2])

def add_new_actor(self, layer_index: int, actor, actor_name: str):
if actor is not None:
Expand Down Expand Up @@ -274,12 +271,12 @@ def lerp_y(y):
color = imgui.get_color_u32_rgba(*color_for_layer(layer_name))
for actor_name in self.bmsld.raw.actors[layer_index]:
actor = self.bmsld.raw.actors[layer_index][actor_name]
if "x" not in actor:
if "position" not in actor:
# TODO: vPos might be a required field. Re-visit after editor fields
continue

final_x = lerp_x(actor.x)
final_y = lerp_y(actor.y)
final_x = lerp_x(actor.position[0])
final_y = lerp_y(actor.position[1])
if (layer_name, actor_name) in highlighted_actors_in_list:
draw_list.add_circle_filled(final_x, final_y, 15, imgui.get_color_u32_rgba(1, 1, 1, 1))
else:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
construct==2.10.68
glfw==2.6.2
imgui==2.0.0
mercury-engine-data-structures==0.24.0
mercury-engine-data-structures==0.25.0
PyOpenGL==3.1.7
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers =
[options]
packages = find:
install_requires =
mercury-engine-data-structures>=0.24.0
mercury-engine-data-structures>=0.25.0
imgui[glfw]

include_package_data = True
Expand Down