bind method ‘get_shader_rid’ for Material

This commit is contained in:
milkiq 2024-07-31 14:04:31 +08:00
parent 3e0c10d393
commit fc81b16741
2 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,12 @@
Creates a placeholder version of this resource ([PlaceholderMaterial]).
</description>
</method>
<method name="get_shader_rid" qualifiers="const">
<return type="RID" />
<description>
Returns the RID of the [Material]'s [Shader]. If you inherit from [Material] and create a custom material, you can override the [method _get_shader_rid] method to return the RID of your custom shader.
</description>
</method>
<method name="inspect_native_shader_code">
<return type="void" />
<description>

View File

@ -152,6 +152,8 @@ void Material::_bind_methods() {
ClassDB::bind_method(D_METHOD("create_placeholder"), &Material::create_placeholder);
ClassDB::bind_method(D_METHOD("get_shader_rid"), &Material::get_shader_rid);
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_priority", PROPERTY_HINT_RANGE, itos(RENDER_PRIORITY_MIN) + "," + itos(RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "next_pass", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "set_next_pass", "get_next_pass");