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

Setter function can't be located in source code #31

Closed
farfalk opened this issue Jan 16, 2024 · 2 comments · Fixed by #32
Closed

Setter function can't be located in source code #31

farfalk opened this issue Jan 16, 2024 · 2 comments · Fixed by #32

Comments

@farfalk
Copy link

farfalk commented Jan 16, 2024

Hi, thank you for your work!

The issue happens with all setters associated with exported properties. I will give an easy to replicate example.

The code:

@export var max_height: float = 1.0 :
	set(value):
		max_height = value
		_update_height()

The setter is shown as @max_height_setter with a green tag in the lateral panel.

The error, when clicking on @max_height_setter:

func core/variant/variant_utility.cpp:1091 - func @max_height_setter( or static not found in source code

My system: Windows 10 latest update, Godot 4.2.1 stable

@farfalk
Copy link
Author

farfalk commented Jan 16, 2024

As an easy workaround, it's possible to add:

if (('func @' in type_with_text) and ('_setter(' in type_with_text)):
    # This is a setter of a variable. Trim!
    type_with_text = "var " + type_with_text.trim_prefix('func @').trim_suffix('_setter(')

here:


like this:

[...]
var type_with_text: String = type + " " + text
if (type == "func"):
    type_with_text = type_with_text + "("	

if (('func @' in type_with_text) and ('_setter(' in type_with_text)):
    # This is a setter of a variable. Trim!
    type_with_text = "var " + type_with_text.trim_prefix('func @').trim_suffix('_setter(')

var source_code: String = script.get_source_code()
[...]

@Maran23
Copy link
Owner

Maran23 commented Jan 18, 2024

Interesting, I did not tested it with inline getter or setters yet.
I'm always using e.g. set = set_speed, get = get_speed.

I will check this out soon, thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants