-
Notifications
You must be signed in to change notification settings - Fork 21
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
Breaking Change: Remove 'Callback' from Python host fn method/class names. #997
Conversation
Appears some changes in this PR have not worked as intended and have broken the e.g. def addInitFunction(self, *args):
r"""
*Overload 1:*
Adds an init function to the simulation
Init functions execute once before the simulation begins
:type func_p: void
:param func_p: Pointer to the desired init function
:raises: exception::InvalidHostFunc If the init function has already been added to this model description
Notes: Init functions are executed in the order they were added to the model
|
*Overload 2:*
Adds an init function callback to the simulation. The callback objects is similar to adding via addInitFunction
however the runnable function is encapsulated within an object which permits cross language support in swig.
Init functions execute once before the simulation begins
:type func_callback: :py:class:`HostFunctionCallback`
:param func_callback: Pointer to the desired init function callback
:raises: exception::InvalidHostFunc If the init function has already been added to this model description
Notes: Init functions are executed in the order they were added to the model
"""
try:
func_callback = func_callback.__disown__()
except:
pass
return _pyflamegpu.ModelDescription_addInitFunction(self, *args)
|
Ah think I've solved the issue. I had ignored the functions incorrectly specifying |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, pytest all passes under linux.
Raised one comment about a c++ class with Callback in the name still incase it was missed rather than intentionally still there, but its fine if it is intentional.
Assuming CI passes this can be merged. There's something I don't think should compile (a returned struct before it's used by a prototype, so size unknown), but it worked for me locally. |
This better unifies it with the C API.
Also fixed a bug, whereby the
__disown__()
fix (#975), had failed to addressaddExitCondition()
.Have also made it private
LayerDescription::_addHostFunction()
.Docs PR: FLAMEGPU/FLAMEGPU2-docs#128
Relates #237 #375