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

[3.x] Return RID instead of Object id in area-body_shape_entered-exited signals. #42743

Merged
merged 1 commit into from
May 19, 2021

Conversation

madmiraal
Copy link
Contributor

3.2 version of #42742.

@madmiraal madmiraal added this to the 3.2 milestone Oct 12, 2020
@madmiraal madmiraal requested a review from a team as a code owner October 12, 2020 15:44
@madmiraal madmiraal force-pushed the fix-12215-3.2 branch 2 times, most recently from 2dc217c to 6f1dd7e Compare October 13, 2020 07:05
@capnm
Copy link
Contributor

capnm commented Oct 13, 2020

The debugger doesn't like it;)
grafik

@madmiraal
Copy link
Contributor Author

The debugger is saying the RID is not a valid resource of the Area or RigidBody that is running the code, which is true. It is, however, a valid RID of the PhysicsServer.

@madmiraal
Copy link
Contributor Author

Rebased following merge of #42715.

@madmiraal madmiraal requested review from a team as code owners March 12, 2021 12:26
Base automatically changed from 3.2 to 3.x March 16, 2021 11:11
@akien-mga akien-mga modified the milestones: 3.2, 3.3 Mar 17, 2021
@akien-mga akien-mga changed the title [3.2] Return RID instead of Object id in area-body_shape_entered-exited signals. [3.x] Return RID instead of Object id in area-body_shape_entered-exited signals. Mar 26, 2021
@akien-mga akien-mga modified the milestones: 3.3, 3.4 Mar 26, 2021
@pouleyKetchoupp
Copy link
Contributor

For info, the Invalid RID message is due to a known general issue with RID type in the debugger: #33797

@akien-mga
Copy link
Member

The master PR was merged, so this should be mergeable once rebased too.

@akien-mga akien-mga merged commit ea0ccf6 into godotengine:3.x May 19, 2021
@akien-mga
Copy link
Member

Thanks!

@madmiraal madmiraal deleted the fix-12215-3.2 branch May 19, 2021 12:18
@belzecue
Copy link

belzecue commented Jul 31, 2021

Today I tested my 3.3.2 3D project against 3.4 beta2 and this RID change broke my project and stopped collisions for area-body_shape_entered-exited signal. The reason is the pre-3.4 default typing of body_id as Int for signal template code:

func _on_Area_body_shape_entered(body_id: int, body: Node, body_shape: int, local_shape: int) -> void:
	var parent := body.get_parent()
	var parent_class := parent.get_class()

	parent.visible = true
	if parent_class == "OmniLight":
		omnilight_controller._on_Camera_collider_entered(parent)

Once I switched body_id types to the new RID typing, everything went back to working fine.

func _on_Area_body_shape_entered(body_id: RID, body: Node, body_shape: int, local_shape: int) -> void:

@pouleyKetchoupp
Copy link
Contributor

You should get an error similar to this one at runtime:
ERROR: Error calling method from signal 'area_shape_entered': 'Area(Area.gd)::_on_Area_area_shape_entered': Cannot convert argument 1 from RID to int..

But it would be great to get an error in the script too. I wonder how complicated it would be to add.

@belzecue
Copy link

You should get an error similar to this one at runtime

That is the case, yes. I missed seeing it first time around, in my panic :)

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.

5 participants