Skip to content

Fixed an animation error when setting a model to Player. #435

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

Merged
merged 2 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Wrapped Entity.set_model with wrap_entity_mem_func.
  • Loading branch information
CookStar committed Nov 17, 2021
commit 8d200159f8832818aa7b815e6c0e326c53051d09
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[virtual_function]

# _ZN11CBaseEntity8SetModelEPKc
[[_set_model]]
[[set_model]]
offset_linux = 27
offset_windows = 26
arguments = STRING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ srv_check = False
[virtual_function]

# _ZN11CBaseEntity8SetModelEPKc
[[_set_model]]
[[set_model]]
offset_linux = 28
offset_windows = 27
arguments = STRING
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[virtual_function]

# _ZN11CBaseEntity8SetModelEPKc
[[_set_model]]
[[set_model]]
offset_linux = 25
offset_windows = 24
arguments = STRING
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[virtual_function]

# _ZN11CBaseEntity8SetModelEPKc
[[_set_model]]
[[set_model]]
offset_linux = 28
offset_windows = 27
arguments = STRING
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[virtual_function]

# _ZN11CBaseEntity8SetModelEPKc
[[_set_model]]
[[set_model]]
offset_linux = 25
offset_windows = 24
arguments = STRING
Expand Down
13 changes: 9 additions & 4 deletions addons/source-python/packages/source-python/entities/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,21 @@ def get_model(self):

return Model(model_name)

@wrap_entity_mem_func
def set_model(self, model):
"""Set the entity's model to the given model.

:param Model model:
The model to set.
:param str/Model model:
The model path or model to set.
"""
self._set_model(model.path)
if isinstance(model, Model):
model = model.path

return [model]

model = property(
get_model, set_model,
get_model,
lambda self, model: self.set_model(model),
doc="""Property to get/set the entity's model.

.. seealso:: :meth:`get_model` and :meth:`set_model`""")
Expand Down