2023-01-05 12:25:55 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* material_editor_plugin.cpp */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2017-08-26 15:46:49 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
#include "material_editor_plugin.h"
|
|
|
|
|
2022-07-31 23:20:24 +00:00
|
|
|
#include "core/config/project_settings.h"
|
2022-02-12 01:46:22 +00:00
|
|
|
#include "editor/editor_node.h"
|
2019-12-24 07:17:23 +00:00
|
|
|
#include "editor/editor_scale.h"
|
2022-07-31 18:14:15 +00:00
|
|
|
#include "editor/editor_settings.h"
|
2022-03-25 17:06:46 +00:00
|
|
|
#include "editor/editor_undo_redo_manager.h"
|
2023-04-07 16:59:49 +00:00
|
|
|
#include "scene/3d/camera_3d.h"
|
|
|
|
#include "scene/3d/light_3d.h"
|
|
|
|
#include "scene/3d/mesh_instance_3d.h"
|
|
|
|
#include "scene/gui/box_container.h"
|
2023-06-29 11:48:53 +00:00
|
|
|
#include "scene/gui/button.h"
|
2023-04-07 16:59:49 +00:00
|
|
|
#include "scene/gui/color_rect.h"
|
2020-04-01 18:28:09 +00:00
|
|
|
#include "scene/gui/subviewport_container.h"
|
2023-04-12 19:02:28 +00:00
|
|
|
#include "scene/main/viewport.h"
|
2021-10-03 11:28:55 +00:00
|
|
|
#include "scene/resources/fog_material.h"
|
2022-08-18 09:09:22 +00:00
|
|
|
#include "scene/resources/particle_process_material.h"
|
2020-03-20 00:32:19 +00:00
|
|
|
#include "scene/resources/sky_material.h"
|
2017-09-22 12:20:28 +00:00
|
|
|
|
2022-09-07 05:17:57 +00:00
|
|
|
void MaterialEditor::gui_input(const Ref<InputEvent> &p_event) {
|
|
|
|
ERR_FAIL_COND(p_event.is_null());
|
|
|
|
|
|
|
|
Ref<InputEventMouseMotion> mm = p_event;
|
2023-01-07 23:55:54 +00:00
|
|
|
if (mm.is_valid() && (mm->get_button_mask().has_flag(MouseButtonMask::LEFT))) {
|
2022-09-07 05:17:57 +00:00
|
|
|
rot.x -= mm->get_relative().y * 0.01;
|
|
|
|
rot.y -= mm->get_relative().x * 0.01;
|
|
|
|
|
|
|
|
rot.x = CLAMP(rot.x, -Math_PI / 2, Math_PI / 2);
|
|
|
|
_update_rotation();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-01 15:52:49 +00:00
|
|
|
void MaterialEditor::_update_theme_item_cache() {
|
|
|
|
Control::_update_theme_item_cache();
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
theme_cache.light_1_icon = get_theme_icon(SNAME("MaterialPreviewLight1"), SNAME("EditorIcons"));
|
|
|
|
theme_cache.light_2_icon = get_theme_icon(SNAME("MaterialPreviewLight2"), SNAME("EditorIcons"));
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
theme_cache.sphere_icon = get_theme_icon(SNAME("MaterialPreviewSphere"), SNAME("EditorIcons"));
|
|
|
|
theme_cache.box_icon = get_theme_icon(SNAME("MaterialPreviewCube"), SNAME("EditorIcons"));
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2022-09-01 15:52:49 +00:00
|
|
|
theme_cache.checkerboard = get_theme_icon(SNAME("Checkerboard"), SNAME("EditorIcons"));
|
|
|
|
}
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2022-09-01 15:52:49 +00:00
|
|
|
void MaterialEditor::_notification(int p_what) {
|
|
|
|
switch (p_what) {
|
|
|
|
case NOTIFICATION_THEME_CHANGED: {
|
2023-06-29 11:48:53 +00:00
|
|
|
light_1_switch->set_icon(theme_cache.light_1_icon);
|
|
|
|
light_2_switch->set_icon(theme_cache.light_2_icon);
|
|
|
|
|
|
|
|
sphere_switch->set_icon(theme_cache.sphere_icon);
|
|
|
|
box_switch->set_icon(theme_cache.box_icon);
|
2022-02-16 02:44:22 +00:00
|
|
|
} break;
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2022-02-16 02:44:22 +00:00
|
|
|
case NOTIFICATION_DRAW: {
|
|
|
|
Size2 size = get_size();
|
2022-09-01 15:52:49 +00:00
|
|
|
draw_texture_rect(theme_cache.checkerboard, Rect2(Point2(), size), true);
|
2022-02-16 02:44:22 +00:00
|
|
|
} break;
|
2019-03-04 18:52:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-07 05:17:57 +00:00
|
|
|
void MaterialEditor::_update_rotation() {
|
|
|
|
Transform3D t;
|
|
|
|
t.basis.rotate(Vector3(0, 1, 0), -rot.y);
|
|
|
|
t.basis.rotate(Vector3(1, 0, 0), -rot.x);
|
|
|
|
rotation->set_transform(t);
|
|
|
|
}
|
|
|
|
|
2019-03-04 18:52:39 +00:00
|
|
|
void MaterialEditor::edit(Ref<Material> p_material, const Ref<Environment> &p_env) {
|
|
|
|
material = p_material;
|
|
|
|
camera->set_environment(p_env);
|
|
|
|
if (!material.is_null()) {
|
2021-12-07 14:16:41 +00:00
|
|
|
Shader::Mode mode = p_material->get_shader_mode();
|
|
|
|
switch (mode) {
|
|
|
|
case Shader::MODE_CANVAS_ITEM:
|
|
|
|
layout_3d->hide();
|
|
|
|
layout_2d->show();
|
|
|
|
vc->hide();
|
|
|
|
rect_instance->set_material(material);
|
|
|
|
break;
|
|
|
|
case Shader::MODE_SPATIAL:
|
|
|
|
layout_2d->hide();
|
|
|
|
layout_3d->show();
|
|
|
|
vc->show();
|
|
|
|
sphere_instance->set_material_override(material);
|
|
|
|
box_instance->set_material_override(material);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2019-03-04 18:52:39 +00:00
|
|
|
} else {
|
|
|
|
hide();
|
|
|
|
}
|
2022-09-07 05:17:57 +00:00
|
|
|
|
|
|
|
rot.x = Math::deg_to_rad(-15.0);
|
|
|
|
rot.y = Math::deg_to_rad(30.0);
|
|
|
|
_update_rotation();
|
2019-03-04 18:52:39 +00:00
|
|
|
}
|
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
void MaterialEditor::_on_light_1_switch_pressed() {
|
|
|
|
light1->set_visible(light_1_switch->is_pressed());
|
|
|
|
}
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
void MaterialEditor::_on_light_2_switch_pressed() {
|
|
|
|
light2->set_visible(light_2_switch->is_pressed());
|
|
|
|
}
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
void MaterialEditor::_on_sphere_switch_pressed() {
|
|
|
|
box_instance->hide();
|
|
|
|
sphere_instance->show();
|
|
|
|
box_switch->set_pressed(false);
|
|
|
|
sphere_switch->set_pressed(true);
|
|
|
|
EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", true);
|
|
|
|
}
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
void MaterialEditor::_on_box_switch_pressed() {
|
|
|
|
box_instance->show();
|
|
|
|
sphere_instance->hide();
|
|
|
|
box_switch->set_pressed(true);
|
|
|
|
sphere_switch->set_pressed(false);
|
|
|
|
EditorSettings::get_singleton()->set_project_metadata("inspector_options", "material_preview_on_sphere", false);
|
2019-03-04 18:52:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MaterialEditor::MaterialEditor() {
|
2023-06-29 11:48:53 +00:00
|
|
|
// Canvas item
|
2021-12-07 14:16:41 +00:00
|
|
|
|
2023-04-28 18:10:04 +00:00
|
|
|
vc_2d = memnew(SubViewportContainer);
|
|
|
|
vc_2d->set_stretch(true);
|
|
|
|
add_child(vc_2d);
|
|
|
|
vc_2d->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
|
|
|
|
|
|
|
|
viewport_2d = memnew(SubViewport);
|
|
|
|
vc_2d->add_child(viewport_2d);
|
|
|
|
viewport_2d->set_disable_input(true);
|
|
|
|
viewport_2d->set_transparent_background(true);
|
|
|
|
|
2021-12-07 14:16:41 +00:00
|
|
|
layout_2d = memnew(HBoxContainer);
|
2021-12-09 10:40:46 +00:00
|
|
|
layout_2d->set_alignment(BoxContainer::ALIGNMENT_CENTER);
|
2023-04-28 18:10:04 +00:00
|
|
|
viewport_2d->add_child(layout_2d);
|
2022-03-19 00:02:57 +00:00
|
|
|
layout_2d->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
|
2021-12-07 14:16:41 +00:00
|
|
|
|
|
|
|
rect_instance = memnew(ColorRect);
|
|
|
|
layout_2d->add_child(rect_instance);
|
|
|
|
rect_instance->set_custom_minimum_size(Size2(150, 150) * EDSCALE);
|
|
|
|
|
|
|
|
layout_2d->set_visible(false);
|
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
// Spatial
|
2021-12-07 14:16:41 +00:00
|
|
|
|
2020-04-01 18:28:09 +00:00
|
|
|
vc = memnew(SubViewportContainer);
|
2019-03-04 18:52:39 +00:00
|
|
|
vc->set_stretch(true);
|
|
|
|
add_child(vc);
|
2022-03-19 00:02:57 +00:00
|
|
|
vc->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
|
2020-03-04 01:51:12 +00:00
|
|
|
viewport = memnew(SubViewport);
|
2020-04-18 09:00:51 +00:00
|
|
|
Ref<World3D> world_3d;
|
2021-06-17 22:03:09 +00:00
|
|
|
world_3d.instantiate();
|
2020-04-18 09:00:51 +00:00
|
|
|
viewport->set_world_3d(world_3d); //use own world
|
2019-03-04 18:52:39 +00:00
|
|
|
vc->add_child(viewport);
|
|
|
|
viewport->set_disable_input(true);
|
|
|
|
viewport->set_transparent_background(true);
|
2022-08-12 23:02:32 +00:00
|
|
|
viewport->set_msaa_3d(Viewport::MSAA_4X);
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2020-03-26 21:49:16 +00:00
|
|
|
camera = memnew(Camera3D);
|
2022-09-07 05:17:57 +00:00
|
|
|
camera->set_transform(Transform3D(Basis(), Vector3(0, 0, 1.1)));
|
2022-07-10 16:47:09 +00:00
|
|
|
// Use low field of view so the sphere/box is fully encompassed within the preview,
|
|
|
|
// without much distortion.
|
|
|
|
camera->set_perspective(20, 0.1, 10);
|
2019-03-04 18:52:39 +00:00
|
|
|
camera->make_current();
|
2022-07-31 23:20:24 +00:00
|
|
|
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
|
|
|
camera_attributes.instantiate();
|
|
|
|
camera->set_attributes(camera_attributes);
|
|
|
|
}
|
2019-03-04 18:52:39 +00:00
|
|
|
viewport->add_child(camera);
|
|
|
|
|
2020-03-26 21:49:16 +00:00
|
|
|
light1 = memnew(DirectionalLight3D);
|
2020-10-17 05:08:21 +00:00
|
|
|
light1->set_transform(Transform3D().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
2019-03-04 18:52:39 +00:00
|
|
|
viewport->add_child(light1);
|
|
|
|
|
2020-03-26 21:49:16 +00:00
|
|
|
light2 = memnew(DirectionalLight3D);
|
2020-10-17 05:08:21 +00:00
|
|
|
light2->set_transform(Transform3D().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
2019-03-04 18:52:39 +00:00
|
|
|
light2->set_color(Color(0.7, 0.7, 0.7));
|
|
|
|
viewport->add_child(light2);
|
|
|
|
|
2022-09-07 05:17:57 +00:00
|
|
|
rotation = memnew(Node3D);
|
|
|
|
viewport->add_child(rotation);
|
|
|
|
|
2020-03-26 21:49:16 +00:00
|
|
|
sphere_instance = memnew(MeshInstance3D);
|
2022-09-07 05:17:57 +00:00
|
|
|
rotation->add_child(sphere_instance);
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2020-03-26 21:49:16 +00:00
|
|
|
box_instance = memnew(MeshInstance3D);
|
2022-09-07 05:17:57 +00:00
|
|
|
rotation->add_child(box_instance);
|
|
|
|
|
|
|
|
box_instance->set_transform(Transform3D() * 0.25);
|
|
|
|
sphere_instance->set_transform(Transform3D() * 0.375);
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2021-06-17 22:03:09 +00:00
|
|
|
sphere_mesh.instantiate();
|
2019-03-04 18:52:39 +00:00
|
|
|
sphere_instance->set_mesh(sphere_mesh);
|
2021-06-17 22:03:09 +00:00
|
|
|
box_mesh.instantiate();
|
2019-03-04 18:52:39 +00:00
|
|
|
box_instance->set_mesh(box_mesh);
|
|
|
|
|
|
|
|
set_custom_minimum_size(Size2(1, 150) * EDSCALE);
|
|
|
|
|
2021-12-07 14:16:41 +00:00
|
|
|
layout_3d = memnew(HBoxContainer);
|
|
|
|
add_child(layout_3d);
|
2022-03-19 00:02:57 +00:00
|
|
|
layout_3d->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT, Control::PRESET_MODE_MINSIZE, 2);
|
2019-03-04 18:52:39 +00:00
|
|
|
|
|
|
|
VBoxContainer *vb_shape = memnew(VBoxContainer);
|
2021-12-07 14:16:41 +00:00
|
|
|
layout_3d->add_child(vb_shape);
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
sphere_switch = memnew(Button);
|
|
|
|
sphere_switch->set_theme_type_variation("PreviewLightButton");
|
2019-03-04 18:52:39 +00:00
|
|
|
sphere_switch->set_toggle_mode(true);
|
|
|
|
sphere_switch->set_pressed(true);
|
|
|
|
vb_shape->add_child(sphere_switch);
|
2023-06-29 11:48:53 +00:00
|
|
|
sphere_switch->connect("pressed", callable_mp(this, &MaterialEditor::_on_sphere_switch_pressed));
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
box_switch = memnew(Button);
|
|
|
|
box_switch->set_theme_type_variation("PreviewLightButton");
|
2019-03-04 18:52:39 +00:00
|
|
|
box_switch->set_toggle_mode(true);
|
|
|
|
box_switch->set_pressed(false);
|
|
|
|
vb_shape->add_child(box_switch);
|
2023-06-29 11:48:53 +00:00
|
|
|
box_switch->connect("pressed", callable_mp(this, &MaterialEditor::_on_box_switch_pressed));
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2021-12-07 14:16:41 +00:00
|
|
|
layout_3d->add_spacer();
|
2019-03-04 18:52:39 +00:00
|
|
|
|
|
|
|
VBoxContainer *vb_light = memnew(VBoxContainer);
|
2021-12-07 14:16:41 +00:00
|
|
|
layout_3d->add_child(vb_light);
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
light_1_switch = memnew(Button);
|
|
|
|
light_1_switch->set_theme_type_variation("PreviewLightButton");
|
2019-03-04 18:52:39 +00:00
|
|
|
light_1_switch->set_toggle_mode(true);
|
2023-06-29 11:48:53 +00:00
|
|
|
light_1_switch->set_pressed(true);
|
2019-03-04 18:52:39 +00:00
|
|
|
vb_light->add_child(light_1_switch);
|
2023-06-29 11:48:53 +00:00
|
|
|
light_1_switch->connect("pressed", callable_mp(this, &MaterialEditor::_on_light_1_switch_pressed));
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2023-06-29 11:48:53 +00:00
|
|
|
light_2_switch = memnew(Button);
|
|
|
|
light_2_switch->set_theme_type_variation("PreviewLightButton");
|
2019-03-04 18:52:39 +00:00
|
|
|
light_2_switch->set_toggle_mode(true);
|
2023-06-29 11:48:53 +00:00
|
|
|
light_2_switch->set_pressed(true);
|
2019-03-04 18:52:39 +00:00
|
|
|
vb_light->add_child(light_2_switch);
|
2023-06-29 11:48:53 +00:00
|
|
|
light_2_switch->connect("pressed", callable_mp(this, &MaterialEditor::_on_light_2_switch_pressed));
|
2019-03-04 18:52:39 +00:00
|
|
|
|
2020-04-01 20:50:06 +00:00
|
|
|
if (EditorSettings::get_singleton()->get_project_metadata("inspector_options", "material_preview_on_sphere", true)) {
|
|
|
|
box_instance->hide();
|
|
|
|
} else {
|
|
|
|
box_instance->show();
|
|
|
|
sphere_instance->hide();
|
|
|
|
box_switch->set_pressed(true);
|
|
|
|
sphere_switch->set_pressed(false);
|
|
|
|
}
|
2019-03-04 18:52:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////
|
|
|
|
|
|
|
|
bool EditorInspectorPluginMaterial::can_handle(Object *p_object) {
|
|
|
|
Material *material = Object::cast_to<Material>(p_object);
|
2020-05-14 14:41:43 +00:00
|
|
|
if (!material) {
|
2019-03-04 18:52:39 +00:00
|
|
|
return false;
|
2020-05-14 14:41:43 +00:00
|
|
|
}
|
2021-12-07 14:16:41 +00:00
|
|
|
Shader::Mode mode = material->get_shader_mode();
|
|
|
|
return mode == Shader::MODE_SPATIAL || mode == Shader::MODE_CANVAS_ITEM;
|
2019-03-04 18:52:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorInspectorPluginMaterial::parse_begin(Object *p_object) {
|
|
|
|
Material *material = Object::cast_to<Material>(p_object);
|
|
|
|
if (!material) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Ref<Material> m(material);
|
|
|
|
|
|
|
|
MaterialEditor *editor = memnew(MaterialEditor);
|
|
|
|
editor->edit(m, env);
|
|
|
|
add_custom_control(editor);
|
|
|
|
}
|
|
|
|
|
2021-12-21 22:19:00 +00:00
|
|
|
void EditorInspectorPluginMaterial::_undo_redo_inspector_callback(Object *p_undo_redo, Object *p_edited, String p_property, Variant p_new_value) {
|
2022-12-23 22:53:16 +00:00
|
|
|
EditorUndoRedoManager *undo_redo = Object::cast_to<EditorUndoRedoManager>(p_undo_redo);
|
|
|
|
ERR_FAIL_NULL(undo_redo);
|
2021-12-21 22:19:00 +00:00
|
|
|
|
|
|
|
// For BaseMaterial3D, if a roughness or metallic textures is being assigned to an empty slot,
|
2022-01-06 23:08:56 +00:00
|
|
|
// set the respective metallic or roughness factor to 1.0 as a convenience feature
|
2021-12-21 22:19:00 +00:00
|
|
|
BaseMaterial3D *base_material = Object::cast_to<StandardMaterial3D>(p_edited);
|
|
|
|
if (base_material) {
|
|
|
|
Texture2D *texture = Object::cast_to<Texture2D>(p_new_value);
|
|
|
|
if (texture) {
|
|
|
|
if (p_property == "roughness_texture") {
|
2022-04-05 10:40:26 +00:00
|
|
|
if (base_material->get_texture(StandardMaterial3D::TEXTURE_ROUGHNESS).is_null()) {
|
2021-12-21 22:19:00 +00:00
|
|
|
undo_redo->add_do_property(p_edited, "roughness", 1.0);
|
|
|
|
|
|
|
|
bool valid = false;
|
|
|
|
Variant value = p_edited->get("roughness", &valid);
|
|
|
|
if (valid) {
|
|
|
|
undo_redo->add_undo_property(p_edited, "roughness", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (p_property == "metallic_texture") {
|
2022-04-05 10:40:26 +00:00
|
|
|
if (base_material->get_texture(StandardMaterial3D::TEXTURE_METALLIC).is_null()) {
|
2021-12-21 22:19:00 +00:00
|
|
|
undo_redo->add_do_property(p_edited, "metallic", 1.0);
|
|
|
|
|
|
|
|
bool valid = false;
|
|
|
|
Variant value = p_edited->get("metallic", &valid);
|
|
|
|
if (valid) {
|
|
|
|
undo_redo->add_undo_property(p_edited, "metallic", value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-04 18:52:39 +00:00
|
|
|
EditorInspectorPluginMaterial::EditorInspectorPluginMaterial() {
|
2021-06-17 22:03:09 +00:00
|
|
|
env.instantiate();
|
2020-03-20 00:32:19 +00:00
|
|
|
Ref<Sky> sky = memnew(Sky());
|
|
|
|
env->set_sky(sky);
|
2019-08-26 20:43:58 +00:00
|
|
|
env->set_background(Environment::BG_COLOR);
|
|
|
|
env->set_ambient_source(Environment::AMBIENT_SOURCE_SKY);
|
|
|
|
env->set_reflection_source(Environment::REFLECTION_SOURCE_SKY);
|
2021-12-21 22:19:00 +00:00
|
|
|
|
2023-08-11 13:55:47 +00:00
|
|
|
EditorNode::get_editor_data().add_undo_redo_inspector_hook_callback(callable_mp(this, &EditorInspectorPluginMaterial::_undo_redo_inspector_callback));
|
2019-03-04 18:52:39 +00:00
|
|
|
}
|
|
|
|
|
2022-01-27 09:36:51 +00:00
|
|
|
MaterialEditorPlugin::MaterialEditorPlugin() {
|
2019-03-04 18:52:39 +00:00
|
|
|
Ref<EditorInspectorPluginMaterial> plugin;
|
2021-06-17 22:03:09 +00:00
|
|
|
plugin.instantiate();
|
2019-03-04 18:52:39 +00:00
|
|
|
add_inspector_plugin(plugin);
|
|
|
|
}
|
|
|
|
|
2019-09-15 04:01:52 +00:00
|
|
|
String StandardMaterial3DConversionPlugin::converts_to() const {
|
2017-09-22 12:20:28 +00:00
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2019-09-15 04:01:52 +00:00
|
|
|
bool StandardMaterial3DConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<StandardMaterial3D> mat = p_resource;
|
2017-09-22 12:20:28 +00:00
|
|
|
return mat.is_valid();
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2019-09-15 04:01:52 +00:00
|
|
|
Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<StandardMaterial3D> mat = p_resource;
|
2017-09-22 12:20:28 +00:00
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
2021-06-17 22:03:09 +00:00
|
|
|
smat.instantiate();
|
2017-09-22 12:20:28 +00:00
|
|
|
|
|
|
|
Ref<Shader> shader;
|
2021-06-17 22:03:09 +00:00
|
|
|
shader.instantiate();
|
2017-09-22 12:20:28 +00:00
|
|
|
|
2020-03-27 18:21:27 +00:00
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
2017-09-22 12:20:28 +00:00
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2017-09-22 12:20:28 +00:00
|
|
|
|
2021-07-24 13:46:25 +00:00
|
|
|
for (const PropertyInfo &E : params) {
|
2019-09-15 04:01:52 +00:00
|
|
|
// Texture parameter has to be treated specially since StandardMaterial3D saved it
|
2017-10-16 09:14:39 +00:00
|
|
|
// as RID but ShaderMaterial needs Texture itself
|
2021-07-16 03:45:57 +00:00
|
|
|
Ref<Texture2D> texture = mat->get_texture_by_name(E.name);
|
2017-10-16 09:14:39 +00:00
|
|
|
if (texture.is_valid()) {
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, texture);
|
2017-10-16 09:14:39 +00:00
|
|
|
} else {
|
2021-07-16 03:45:57 +00:00
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2017-10-16 09:14:39 +00:00
|
|
|
}
|
2017-09-22 12:20:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
2021-09-15 23:45:07 +00:00
|
|
|
smat->set_local_to_scene(mat->is_local_to_scene());
|
|
|
|
smat->set_name(mat->get_name());
|
2017-09-22 12:20:28 +00:00
|
|
|
return smat;
|
|
|
|
}
|
2017-10-12 11:12:50 +00:00
|
|
|
|
2021-10-29 14:49:12 +00:00
|
|
|
String ORMMaterial3DConversionPlugin::converts_to() const {
|
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ORMMaterial3DConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<ORMMaterial3D> mat = p_resource;
|
|
|
|
return mat.is_valid();
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<Resource> ORMMaterial3DConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<ORMMaterial3D> mat = p_resource;
|
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
|
|
|
smat.instantiate();
|
|
|
|
|
|
|
|
Ref<Shader> shader;
|
|
|
|
shader.instantiate();
|
|
|
|
|
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2021-10-29 14:49:12 +00:00
|
|
|
|
|
|
|
for (const PropertyInfo &E : params) {
|
|
|
|
// Texture parameter has to be treated specially since ORMMaterial3D saved it
|
|
|
|
// as RID but ShaderMaterial needs Texture itself
|
|
|
|
Ref<Texture2D> texture = mat->get_texture_by_name(E.name);
|
|
|
|
if (texture.is_valid()) {
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, texture);
|
2021-10-29 14:49:12 +00:00
|
|
|
} else {
|
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2021-10-29 14:49:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
|
|
|
smat->set_local_to_scene(mat->is_local_to_scene());
|
|
|
|
smat->set_name(mat->get_name());
|
|
|
|
return smat;
|
|
|
|
}
|
|
|
|
|
2022-08-18 09:09:22 +00:00
|
|
|
String ParticleProcessMaterialConversionPlugin::converts_to() const {
|
2017-10-12 11:12:50 +00:00
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2022-08-18 09:09:22 +00:00
|
|
|
bool ParticleProcessMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<ParticleProcessMaterial> mat = p_resource;
|
2017-10-12 11:12:50 +00:00
|
|
|
return mat.is_valid();
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2022-08-18 09:09:22 +00:00
|
|
|
Ref<Resource> ParticleProcessMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<ParticleProcessMaterial> mat = p_resource;
|
2017-10-12 11:12:50 +00:00
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
2021-06-17 22:03:09 +00:00
|
|
|
smat.instantiate();
|
2017-10-12 11:12:50 +00:00
|
|
|
|
|
|
|
Ref<Shader> shader;
|
2021-06-17 22:03:09 +00:00
|
|
|
shader.instantiate();
|
2017-10-12 11:12:50 +00:00
|
|
|
|
2020-03-27 18:21:27 +00:00
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
2017-10-12 11:12:50 +00:00
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2017-10-12 11:12:50 +00:00
|
|
|
|
2021-07-24 13:46:25 +00:00
|
|
|
for (const PropertyInfo &E : params) {
|
2021-07-16 03:45:57 +00:00
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2017-10-12 11:12:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
2021-09-15 23:45:07 +00:00
|
|
|
smat->set_local_to_scene(mat->is_local_to_scene());
|
|
|
|
smat->set_name(mat->get_name());
|
2017-10-12 11:12:50 +00:00
|
|
|
return smat;
|
|
|
|
}
|
2017-11-14 18:44:51 +00:00
|
|
|
|
|
|
|
String CanvasItemMaterialConversionPlugin::converts_to() const {
|
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2017-11-14 18:44:51 +00:00
|
|
|
bool CanvasItemMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<CanvasItemMaterial> mat = p_resource;
|
|
|
|
return mat.is_valid();
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2018-08-26 10:25:41 +00:00
|
|
|
Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
2017-11-14 18:44:51 +00:00
|
|
|
Ref<CanvasItemMaterial> mat = p_resource;
|
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
2021-06-17 22:03:09 +00:00
|
|
|
smat.instantiate();
|
2017-11-14 18:44:51 +00:00
|
|
|
|
|
|
|
Ref<Shader> shader;
|
2021-06-17 22:03:09 +00:00
|
|
|
shader.instantiate();
|
2017-11-14 18:44:51 +00:00
|
|
|
|
2020-03-27 18:21:27 +00:00
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
2017-11-14 18:44:51 +00:00
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2017-11-14 18:44:51 +00:00
|
|
|
|
2021-07-24 13:46:25 +00:00
|
|
|
for (const PropertyInfo &E : params) {
|
2021-07-16 03:45:57 +00:00
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2017-11-14 18:44:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
2021-09-15 23:45:07 +00:00
|
|
|
smat->set_local_to_scene(mat->is_local_to_scene());
|
|
|
|
smat->set_name(mat->get_name());
|
2017-11-14 18:44:51 +00:00
|
|
|
return smat;
|
|
|
|
}
|
2020-03-20 00:32:19 +00:00
|
|
|
|
|
|
|
String ProceduralSkyMaterialConversionPlugin::converts_to() const {
|
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2020-03-20 00:32:19 +00:00
|
|
|
bool ProceduralSkyMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<ProceduralSkyMaterial> mat = p_resource;
|
|
|
|
return mat.is_valid();
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2020-03-20 00:32:19 +00:00
|
|
|
Ref<Resource> ProceduralSkyMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<ProceduralSkyMaterial> mat = p_resource;
|
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
2021-06-17 22:03:09 +00:00
|
|
|
smat.instantiate();
|
2020-03-20 00:32:19 +00:00
|
|
|
|
|
|
|
Ref<Shader> shader;
|
2021-06-17 22:03:09 +00:00
|
|
|
shader.instantiate();
|
2020-03-20 00:32:19 +00:00
|
|
|
|
2020-03-27 18:21:27 +00:00
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
2020-03-20 00:32:19 +00:00
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2020-03-20 00:32:19 +00:00
|
|
|
|
2021-07-24 13:46:25 +00:00
|
|
|
for (const PropertyInfo &E : params) {
|
2021-07-16 03:45:57 +00:00
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2020-03-20 00:32:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
2021-09-15 23:45:07 +00:00
|
|
|
smat->set_local_to_scene(mat->is_local_to_scene());
|
|
|
|
smat->set_name(mat->get_name());
|
2020-03-20 00:32:19 +00:00
|
|
|
return smat;
|
|
|
|
}
|
|
|
|
|
|
|
|
String PanoramaSkyMaterialConversionPlugin::converts_to() const {
|
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2020-03-20 00:32:19 +00:00
|
|
|
bool PanoramaSkyMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<PanoramaSkyMaterial> mat = p_resource;
|
|
|
|
return mat.is_valid();
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2020-03-20 00:32:19 +00:00
|
|
|
Ref<Resource> PanoramaSkyMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<PanoramaSkyMaterial> mat = p_resource;
|
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
2021-06-17 22:03:09 +00:00
|
|
|
smat.instantiate();
|
2020-03-20 00:32:19 +00:00
|
|
|
|
|
|
|
Ref<Shader> shader;
|
2021-06-17 22:03:09 +00:00
|
|
|
shader.instantiate();
|
2020-03-20 00:32:19 +00:00
|
|
|
|
2020-03-27 18:21:27 +00:00
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
2020-03-20 00:32:19 +00:00
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2020-03-20 00:32:19 +00:00
|
|
|
|
2021-07-24 13:46:25 +00:00
|
|
|
for (const PropertyInfo &E : params) {
|
2021-07-16 03:45:57 +00:00
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2020-03-20 00:32:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
2021-09-15 23:45:07 +00:00
|
|
|
smat->set_local_to_scene(mat->is_local_to_scene());
|
|
|
|
smat->set_name(mat->get_name());
|
2020-03-20 00:32:19 +00:00
|
|
|
return smat;
|
|
|
|
}
|
|
|
|
|
|
|
|
String PhysicalSkyMaterialConversionPlugin::converts_to() const {
|
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2020-03-20 00:32:19 +00:00
|
|
|
bool PhysicalSkyMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<PhysicalSkyMaterial> mat = p_resource;
|
|
|
|
return mat.is_valid();
|
|
|
|
}
|
2020-05-14 12:29:06 +00:00
|
|
|
|
2020-03-20 00:32:19 +00:00
|
|
|
Ref<Resource> PhysicalSkyMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<PhysicalSkyMaterial> mat = p_resource;
|
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
2021-06-17 22:03:09 +00:00
|
|
|
smat.instantiate();
|
2020-03-20 00:32:19 +00:00
|
|
|
|
|
|
|
Ref<Shader> shader;
|
2021-06-17 22:03:09 +00:00
|
|
|
shader.instantiate();
|
2020-03-20 00:32:19 +00:00
|
|
|
|
2020-03-27 18:21:27 +00:00
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
2020-03-20 00:32:19 +00:00
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2020-03-20 00:32:19 +00:00
|
|
|
|
2021-07-24 13:46:25 +00:00
|
|
|
for (const PropertyInfo &E : params) {
|
2021-07-16 03:45:57 +00:00
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2020-03-20 00:32:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
2021-09-15 23:45:07 +00:00
|
|
|
smat->set_local_to_scene(mat->is_local_to_scene());
|
|
|
|
smat->set_name(mat->get_name());
|
2020-03-20 00:32:19 +00:00
|
|
|
return smat;
|
|
|
|
}
|
2021-10-03 11:28:55 +00:00
|
|
|
|
|
|
|
String FogMaterialConversionPlugin::converts_to() const {
|
|
|
|
return "ShaderMaterial";
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FogMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<FogMaterial> mat = p_resource;
|
|
|
|
return mat.is_valid();
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<Resource> FogMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const {
|
|
|
|
Ref<FogMaterial> mat = p_resource;
|
|
|
|
ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
|
|
|
|
|
|
|
|
Ref<ShaderMaterial> smat;
|
|
|
|
smat.instantiate();
|
|
|
|
|
|
|
|
Ref<Shader> shader;
|
|
|
|
shader.instantiate();
|
|
|
|
|
|
|
|
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
|
|
|
|
|
|
|
shader->set_code(code);
|
|
|
|
|
|
|
|
smat->set_shader(shader);
|
|
|
|
|
|
|
|
List<PropertyInfo> params;
|
2022-08-27 09:22:43 +00:00
|
|
|
RS::get_singleton()->get_shader_parameter_list(mat->get_shader_rid(), ¶ms);
|
2021-10-03 11:28:55 +00:00
|
|
|
|
|
|
|
for (const PropertyInfo &E : params) {
|
|
|
|
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E.name);
|
2022-08-27 09:22:43 +00:00
|
|
|
smat->set_shader_parameter(E.name, value);
|
2021-10-03 11:28:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
smat->set_render_priority(mat->get_render_priority());
|
|
|
|
return smat;
|
|
|
|
}
|