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

weird behavior in app handler callbacks #3

Open
ihm-tswow opened this issue Aug 30, 2022 · 0 comments
Open

weird behavior in app handler callbacks #3

ihm-tswow opened this issue Aug 30, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@ihm-tswow
Copy link
Owner

bxx/bxx/app_handlers.cpp

Lines 13 to 27 in d89632f

void register_handler(std::string const& target, std::function<void(bxx::python_tuple const&)> func)
{
// todo: for some bizarre reason this stops working if i don't pass all varargs python-side,
// but everything is still in the first tuple once it reaches C++
size_t event_idx = lib_register_event([=](bxx::python_tuple const& tuple) {
func(tuple.get<python_tuple>(0));
return bxx::python_object();
});
exec({
fmt::format("@bpy.app.handlers.persistent"),
fmt::format("def event_{}_{}(*args):",get_script_index(),event_idx),
fmt::format(" fire_event({},{}, args)",get_script_index(),event_idx),
fmt::format("register_app_handler({}, bpy.app.handlers.{}, event_{}_{})", get_script_index(), target, get_script_index(), event_idx, target)
});
}

@ihm-tswow ihm-tswow added the bug Something isn't working label Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant