Skip to content

PoolColorArray.set doesn't work #19674

Open
@henriiquecampos

Description

Godot version: 3.0.3

OS/device including version: Linux x64 (SolusOS 3.9999 Gnome 3.28.2)

Issue description:

I'm trying to use Polygon2D.vertex_color.set(0, color) and this approach doesn't do nothing, while vertex_colors[0] = color works, the below doesn't:

func _ready():
	var color = Color(1, 1, 1, 1)
	print(color)
	vertex_colors.set(0, color)
	print(vertex_colors[0])

the print returns:

1,1,1,1
1,0.701961,0.501961,1

While Polygon2D.vertex_color by creating another PoolColorArray:

var white = Color(1, 1, 1, 1)
	var colors = [white, white, white, white]
	print(colors[0])
	vertex_colors = colors
	print(vertex_colors[0])

the print returns:

1,1,1,1
1,1,1,1

Both are reflected in the actual game (first one doesn't modify the Polygon2D vertex colors, second approach does)

Also, during some tests I realized that unfortunately we have a not true statement on latest post about the Animation System.

I tried to Tween.interpolate_property and Tween.interpolate_method both trying to interpolate the Polygon2D.vertex_color and I got this error:

0:00:00:0209 - Invalid param type, except(int/real/vector2/vector/matrix/matrix32/quat/aabb/transform/color)
----------
Type:Error
Description: 
Time: 0:00:00:0209
C Error: Invalid param type, except(int/real/vector2/vector/matrix/matrix32/quat/aabb/transform/color)
C Source: scene/animation/tween.cpp:991
C Function: _calc_delta_val

So it seems like:

any property from any object can be animated or tweened

Is not true, unfortunately :(

Steps to reproduce:

  1. Create a Polygon2D
  2. On its vertex_colors property create the desired array
  3. Try to PoolColorArray.set(index, color)

1.Create 2 PoolColorArray
2. Try to Tween.interpolate_property using them as initial_value and final_value

Minimal reproduction project:

Polygon2D.zip

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions