Repository: godot
Issue: Error in Visual Shader imported from Godot 3.5.1 to Godot4 with Texture->Texture2D Node when using Alpha-parameter
Labels: topic:editor,topic:shaders

### Godot version

4.0rc2

### System information

Windows 10

### Issue description

It appears that under certain conditions, the import of a Visual Shader attached to a node in a Godot 3.5.1 project causes an error when opening the converted scene in Godot 4. The scene loads, but the resulting shader looks off:

It seems that the issue lies with the fact that in Godot 3, Texture offered both a "Color" and "Alpha" output, whereas in Godot 4, the latter is considered a component of the former (which makes perfect sense). Because of this, any connection from the "Alpha" output is now lost and, worse, there seems to be an error (see below). The error message suggests that it tries to connect the second (index=1) port, which was "Alpha" beforehand, which no longer exists.

```
  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:723 - Condition "g->nodes.has(p_id)" is true.
  scene/resources/visual_shader.cpp:970 - Index p_from_port = 1 is out of bounds (g->nodes[p_from_node].node->get_expanded_output_port_count() = 1).
```

Here are screenshots of the Visual Shaders as they appear in my Demo-project. In the Godot 4-screenshot, I have moved the Nodes slightly to ensure they fit the screenshot, their positions were as imported (just their size is now different)

Look in Godot 3.5.1:
![VS_G3](https://user-images.githubusercontent.com/58372501/219153262-1a59df82-ceef-4b9e-b784-f450dab2d8cd.PNG)
VS in Godot 4.0 RC 2:
![VS_G4](https://user-images.githubusercontent.com/58372501/219153332-90862528-bd9b-4907-9495-1084f9a16ff8.PNG)

Note that the whole Vector composing/Decomposing is *not necessary for the bug to appear*. I just forgot to remove that part before uploading my projects. I have tested it without them, and I still see the error.

### Steps to reproduce

**In Godot 3.5**
* Create a scene, add a TextureRect, attach a Texture to it (I used a generated Gradient-texture)
* Attach a Shader Material to it, then create a Visual Shader from there
* Make sure to create a Texture2D-node, attach it's "Color" and "Alpha" output to the final "Color" and "Alpha" input respectively
* Save and close the project

**In Godot 4.0**
* Open the project you just created, and let it Import and convert everything
* Open the scene you've made
* The Error should appear, and the Texture Rect should not show the attached texture. Check the Visual Shader to see the missing connections.

### Minimal reproduction project


Here is the Godot 3.5.1 Project. When importing it in Godot 4, and then opening the scene "Demo.tscn", the error can be observed.
[VisualShaderImportToG4Bug.zip](https://github.com/godotengine/godot/files/10747438/VisualShaderImportToG4Bug.zip)

In case the above link does not work for some reason, I have created a small [public repository](https://github.com/opgjoh/VisualShaderImportToGodot4Bug) with the Godot 3.5 and Godot 4.0 Project ready :)