Add handling of script creation/deletion for custom visual shader nodes

This commit is contained in:
Yuri Rubinsky 2023-01-23 12:01:28 +03:00
parent eaf306e0b1
commit 6713e0fa5b
6 changed files with 176 additions and 46 deletions

View file

@ -536,12 +536,17 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<
}
void DependencyRemoveDialog::ok_pressed() {
for (int i = 0; i < files_to_delete.size(); ++i) {
if (ResourceCache::has(files_to_delete[i])) {
Ref<Resource> res = ResourceCache::get_ref(files_to_delete[i]);
for (const KeyValue<String, String> &E : all_remove_files) {
String file = E.key;
if (ResourceCache::has(file)) {
Ref<Resource> res = ResourceCache::get_ref(file);
emit_signal(SNAME("resource_removed"), res);
res->set_path("");
}
}
for (int i = 0; i < files_to_delete.size(); ++i) {
// If the file we are deleting for e.g. the main scene, default environment,
// or audio bus layout, we must clear its definition in Project Settings.
if (files_to_delete[i] == String(GLOBAL_GET("application/config/icon"))) {
@ -621,6 +626,7 @@ void DependencyRemoveDialog::ok_pressed() {
}
void DependencyRemoveDialog::_bind_methods() {
ADD_SIGNAL(MethodInfo("resource_removed", PropertyInfo(Variant::OBJECT, "obj")));
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
}