-Fixed post-import script-reload buf, fixes #1683
This commit is contained in:
parent
701335e845
commit
b66b86b05e
|
@ -59,6 +59,10 @@ void Reference::_bind_methods() {
|
||||||
ObjectTypeDB::bind_method(_MD("unreference"),&Reference::unreference);
|
ObjectTypeDB::bind_method(_MD("unreference"),&Reference::unreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Reference::reference_get_count() const {
|
||||||
|
return refcount.get();
|
||||||
|
}
|
||||||
|
|
||||||
void Reference::reference(){
|
void Reference::reference(){
|
||||||
|
|
||||||
refcount.ref();
|
refcount.ref();
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
bool init_ref();
|
bool init_ref();
|
||||||
void reference();
|
void reference();
|
||||||
bool unreference();
|
bool unreference();
|
||||||
|
int reference_get_count() const;
|
||||||
|
|
||||||
Reference();
|
Reference();
|
||||||
~Reference();
|
~Reference();
|
||||||
|
|
|
@ -714,7 +714,8 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ref<EditorScenePostImport> pi;
|
|
||||||
|
|
||||||
|
|
||||||
if (script_path->get_text()!="") {
|
if (script_path->get_text()!="") {
|
||||||
Ref<Script> scr = ResourceLoader::load(script_path->get_text());
|
Ref<Script> scr = ResourceLoader::load(script_path->get_text());
|
||||||
|
@ -724,7 +725,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pi = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) );
|
Ref<EditorScenePostImport> pi = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) );
|
||||||
pi->set_script(scr.get_ref_ptr());
|
pi->set_script(scr.get_ref_ptr());
|
||||||
if (!pi->get_script_instance()) {
|
if (!pi->get_script_instance()) {
|
||||||
|
|
||||||
|
@ -732,6 +733,8 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
|
||||||
error_dialog->popup_centered(Size2(200,100));
|
error_dialog->popup_centered(Size2(200,100));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_line("PI REFERENCES "+itos(scr->reference_get_count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2726,7 +2729,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
|
||||||
Ref<EditorScenePostImport> post_import_script;
|
Ref<EditorScenePostImport> post_import_script;
|
||||||
|
|
||||||
if (post_import_script_path!="") {
|
if (post_import_script_path!="") {
|
||||||
post_import_script_path = EditorImportPlugin::expand_source_path(post_import_script_path);
|
post_import_script_path = post_import_script_path;
|
||||||
Ref<Script> scr = ResourceLoader::load(post_import_script_path);
|
Ref<Script> scr = ResourceLoader::load(post_import_script_path);
|
||||||
if (!scr.is_valid()) {
|
if (!scr.is_valid()) {
|
||||||
EditorNode::add_io_error("Couldn't load post-import script: '"+post_import_script_path);
|
EditorNode::add_io_error("Couldn't load post-import script: '"+post_import_script_path);
|
||||||
|
@ -2748,8 +2751,11 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
|
||||||
EditorNode::add_io_error("Error running Post-Import script: '"+post_import_script_path);
|
EditorNode::add_io_error("Error running Post-Import script: '"+post_import_script_path);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// IMPORT IMAGES
|
/// IMPORT IMAGES
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue