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

Fix check in Object._ValidateProperty example #95341

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

esainane
Copy link
Contributor

@esainane esainane commented Aug 9, 2024

The GDScript version above makes the number property read only whenever is_number_editable is false.

func _validate_property(property: Dictionary):
	if property.name == "number" and not is_number_editable:
		property.usage |= PROPERTY_USAGE_READ_ONLY

The C# version is similar, but omits the negation, so the Number property is made read only whenever is_number_editable is true.

This adds the negation to the C# example, making it match the GDScript example.

The GDScript version above makes the `number` property read only whenever
`is_number_editable` is false.

```gdscript
func _validate_property(property: Dictionary):
	if property.name == "number" and not is_number_editable:
		property.usage |= PROPERTY_USAGE_READ_ONLY
```

The C# version is similar, but omits the negation, so the Number property is
made read only whenever `is_number_editable` is true.

This adds the negation to the C# example, making it match the GDScript
example.
@esainane esainane requested a review from a team as a code owner August 9, 2024 19:10
@akien-mga akien-mga added this to the 4.3 milestone Aug 9, 2024
Copy link
Member

@raulsntos raulsntos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks!

@akien-mga akien-mga merged commit f16c3d1 into godotengine:master Aug 12, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants