Merge pull request #74973 from timothyqiu/a-color
[3.x] Add Color + alpha constructor for Color
This commit is contained in:
commit
0facd88410
2 changed files with 14 additions and 5 deletions
|
@ -1103,11 +1103,8 @@ struct _VariantCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Color_init3(Variant &r_ret, const Variant **p_args) {
|
static void Color_init3(Variant &r_ret, const Variant **p_args) {
|
||||||
r_ret = Color::html(*p_args[0]);
|
Color c = *p_args[0];
|
||||||
}
|
r_ret = Color(c.r, c.g, c.b, *p_args[1]);
|
||||||
|
|
||||||
static void Color_init4(Variant &r_ret, const Variant **p_args) {
|
|
||||||
r_ret = Color::hex(*p_args[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AABB_init1(Variant &r_ret, const Variant **p_args) {
|
static void AABB_init1(Variant &r_ret, const Variant **p_args) {
|
||||||
|
@ -2212,6 +2209,7 @@ void register_variant_methods() {
|
||||||
|
|
||||||
_VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL);
|
_VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL);
|
||||||
_VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL);
|
_VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL);
|
||||||
|
_VariantCall::add_constructor(_VariantCall::Color_init3, Variant::COLOR, "from", Variant::COLOR, "alpha", Variant::REAL);
|
||||||
|
|
||||||
_VariantCall::add_constructor(_VariantCall::AABB_init1, Variant::AABB, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
|
_VariantCall::add_constructor(_VariantCall::AABB_init1, Variant::AABB, "position", Variant::VECTOR3, "size", Variant::VECTOR3);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,17 @@
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="Color">
|
||||||
|
<return type="Color" />
|
||||||
|
<argument index="0" name="from" type="Color" />
|
||||||
|
<argument index="1" name="alpha" type="float" />
|
||||||
|
<description>
|
||||||
|
Constructs a color from the existing color, with [member a] set to the given [code]alpha[/code] value.
|
||||||
|
[codeblock]
|
||||||
|
var red = Color(Color.red, 0.2) # 20% opaque red.
|
||||||
|
[/codeblock]
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="Color">
|
<method name="Color">
|
||||||
<return type="Color" />
|
<return type="Color" />
|
||||||
<argument index="0" name="r" type="float" />
|
<argument index="0" name="r" type="float" />
|
||||||
|
|
Loading…
Reference in a new issue