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

Add autocompletion for RenderingServer's global shader methods & has_os_feature #86798

Merged
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
19 changes: 19 additions & 0 deletions servers/rendering_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2204,6 +2204,25 @@ void RenderingServer::fix_surface_compatibility(SurfaceData &p_surface, const St
}
#endif

#ifdef TOOLS_ENABLED
void RenderingServer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
Mickeon marked this conversation as resolved.
Show resolved Hide resolved
String pf = p_function;
if (p_idx == 0) {
if (pf == "global_shader_parameter_set" || pf == "global_shader_parameter_set_override" ||
pf == "global_shader_parameter_get" || pf == "global_shader_parameter_get_type" || pf == "global_shader_parameter_remove") {
for (StringName E : global_shader_parameter_get_list()) {
r_options->push_back(E.operator String().quote());
}
} else if (pf == "has_os_feature") {
for (String E : { "\"rgtc\"", "\"s3tc\"", "\"bptc\"", "\"etc\"", "\"etc2\"", "\"astc\"" }) {
r_options->push_back(E);
}
}
}
Object::get_argument_options(p_function, p_idx, r_options);
}
#endif

void RenderingServer::_bind_methods() {
BIND_CONSTANT(NO_INDEX_ARRAY);
BIND_CONSTANT(ARRAY_WEIGHTS_SIZE);
Expand Down
4 changes: 4 additions & 0 deletions servers/rendering_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,10 @@ class RenderingServer : public Object {

virtual void call_on_render_thread(const Callable &p_callable) = 0;

#ifdef TOOLS_ENABLED
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
#endif

RenderingServer();
virtual ~RenderingServer();

Expand Down
Loading