Created
April 7, 2016 23:39
-
-
Save MarianoGnu/8fa2243b0dca0f73f0f2bfb145a9cc01 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func _on_item_selected(): | |
print("signal emmited") | |
var item = scene_tree.get_selected() | |
var nodepath = item.get_text(0) | |
while (item.get_parent() != scene_tree.get_root()): | |
item = item.get_parent() | |
nodepath = item.get_text(0)+"/"+nodepath | |
var shape_node = scene_root.get_node(nodepath) | |
if mode == 1: # Collision | |
if shape_node extends CollisionShape2D: | |
shape = shape_node.get_shape() | |
collision_node.set_shape(shape) | |
print(shape.get_path()) | |
collision_node.set_pos(shape_node.get_pos()) | |
collision_node.show() | |
collision_poly_node.hide() | |
elif shape_node extends CollisionPolygon2D: | |
shape = shape_node | |
collision_poly_node.set_polygon(shape_node.get_polygon()) | |
collision_poly_node.set_pos(shape_node.get_pos()) | |
collision_poly_node.show() | |
collision_node.hide() | |
else: | |
shape = null | |
occluder_node.hide() | |
navpoly_node.hide() | |
elif mode == 2: # Occlusion | |
if shape_node extends LightOccluder2D: | |
shape = shape_node.get_occluder_polygon() | |
occluder_node.set_occluder_polygon(shape) | |
occluder_path.show() | |
collision_node.hide() | |
collision_poly_node.hide() | |
navpoly_node.hide() | |
else: | |
shape = null | |
elif mode == 3: | |
if shape_node extends NavigationPolygonInstance: | |
shape = shape_node.get_navigation_polygon() | |
navpoly_node.set_navigation_polygon(shape) | |
navpoly_node.show() | |
collision_node.hide() | |
collision_poly_node.hide() | |
occluder_node.hide() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment