diff options
| author | Hiroshi Ogawa | 2017-10-16 18:14:39 +0900 |
|---|---|---|
| committer | Hiroshi Ogawa | 2017-10-19 16:10:24 +0900 |
| commit | 3bd2a4c42169eb141a71fb30e4786d4339e3789a (patch) | |
| tree | 59aec107171bcccbf6f2b866497110ace53b3cb0 /scene/resources/material.cpp | |
| parent | f52ab8d86418a67ddee247ed7765e72935b0c57f (diff) | |
| download | godot-3bd2a4c42169eb141a71fb30e4786d4339e3789a.tar.gz godot-3bd2a4c42169eb141a71fb30e4786d4339e3789a.tar.zst godot-3bd2a4c42169eb141a71fb30e4786d4339e3789a.zip | |
Diffstat (limited to 'scene/resources/material.cpp')
| -rw-r--r-- | scene/resources/material.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 2936df7a5..898a59449 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1242,6 +1242,15 @@ Ref<Texture> SpatialMaterial::get_texture(TextureParam p_param) const { return textures[p_param]; } +Ref<Texture> SpatialMaterial::get_texture_by_name(StringName p_name) const { + for (int i = 0; i < (int)SpatialMaterial::TEXTURE_MAX; i++) { + TextureParam param = TextureParam(i); + if (p_name == shader_names->texture_names[param]) + return textures[param]; + } + return Ref<Texture>(); +} + void SpatialMaterial::_validate_feature(const String &text, Feature feature, PropertyInfo &property) const { if (property.name.begins_with(text) && property.name != text + "_enabled" && !features[feature]) { property.usage = 0; |
