Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep copy custom resource created in 4.4dev4 or newer throws Parser Error: Class hides a global script class #100154

Closed
agshultz opened this issue Dec 7, 2024 · 4 comments · Fixed by #101001

Comments

@agshultz
Copy link

agshultz commented Dec 7, 2024

Tested versions

  • Reproducible in 4.4dev6, 4.3 stable, 4.2.2 stable, 4.0 stable, did not test older version

System information

Godot v4.4.dev6 - Windows 10.0.22631 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Laptop GPU (NVIDIA; 32.0.15.6636) - 13th Gen Intel(R) Core(TM) i9-13900H (20 threads)

Issue description

Deep copying a custom resource ( cust_resource.duplicate(true) ) created in 4.4dev4 or newer results in Parser Error: Class "CustomResource" hides a global script class.

The same project and custom resource instance created in 4.4dev3 or older does not result in the error. Seems to be a regression related to #72119 fixed in #71142

Steps to reproduce

As in MRP:
Create new custom resource with class_name (completely empty class is fine)
Perform a .duplicate(true) on custom resource

Minimal reproduction project (MRP)

mrp_resource_duplicate.zip

@HolonProduction
Copy link
Member

For some reason some editor only metadata gets serialized to the file: metadata/_custom_type_script, this contains the same script as the script property. This metadata is not marked as never duplicate so it will result in the attempt to duplicate the script.

@dalexeev
Copy link
Member

dalexeev commented Dec 8, 2024

@MrDobby92
Copy link

Does anyone know a workaround for this?

@HolonProduction
Copy link
Member

You can manually edit the resource file using a text editor. Remove the metadata/_custom_type_script property, as long as you don't re-save the scene it should keep working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Release Blocker
Development

Successfully merging a pull request may close this issue.

5 participants