godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.89k stars 20.15k forks source link

Migration to Parallax 2D node could update the attach script during migration #95903

Open NekoraiStudios opened 3 weeks ago

NekoraiStudios commented 3 weeks ago

Tested versions

System information

Windows 11, v4.3.stable.steam [77dcf97d8]

Issue description

After using the migration button from ParallaxBackground to Paralax2D Node, Attached script should extend to new node Paralax2D in the script linked to the node.

This script for example was attach to a ParallaxLayer Object

extends ParallaxLayer

func _ready():
    for child in get_children():
        child.scale.y = 0;

func entering_battle():
    for child in get_children():
        var tween = get_tree().create_tween()
        tween.tween_property(child, "scale",Vector2(1,1),1.0)

func exiting_battle():
    for child in get_children():
        var tween = get_tree().create_tween()
        tween.tween_property(child, "scale",Vector2(1,0),1.0)

After using the migration tool the script should look like this

extends Parallax2D

func _ready():
    for child in get_children():
        child.scale.y = 0;

func entering_battle():
    for child in get_children():
        var tween = get_tree().create_tween()
        tween.tween_property(child, "scale",Vector2(1,1),1.0)

func exiting_battle():
    for child in get_children():
        var tween = get_tree().create_tween()
        tween.tween_property(child, "scale",Vector2(1,0),1.0)

Steps to reproduce

Start a project with a ParallaxBackground node, then add a ParallaxLayer node, then attach a script to the layer. Your now ready to use the migration tool. Use it you'll see that the extends of the script isn't updated to the new node type witch is now a Parallax2D node

Minimal reproduction project (MRP)

migrationissue.zip

AThousandShips commented 3 weeks ago

This is more of a proposal than a bug IMO

markdibarry commented 3 weeks ago

I agree that this more of a proposal, but even so I don't believe we usually modify scripts as part of simpler migration tools, and the main reason I imagine is due to creeping complexity. In the case of Parallax2D, in order to properly migrate the script, in addition to modifying the class inheritance, the migration would need to:

That's both a big undertaking that we probably don't have the resources to tackle implementing, and a big risk for destructive changes across a project that many users wouldn't want to take on using if we did. Sometimes there are update tools that handle migrating entire projects from older versions to newer ones, but I don't think we could support for just Parallax2D, unfortunately.