summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-05-17 18:45:56 +0200
committerRémi Verschelde <rverschelde@gmail.com>2017-05-17 18:45:56 +0200
commitc3baf5eb3cf71c6645e2b721c09d284db0f630b2 (patch)
tree435332b46956d320be44f2cdc1f6908da971f8a1 /core
parent98a329670227c726a5d7a196e5cba8dbdd54301b (diff)
Fix two typos from previous commit
Also cleanup comments on variant types.
Diffstat (limited to 'core')
-rw-r--r--core/global_constants.cpp12
-rw-r--r--core/image.cpp2
-rw-r--r--core/io/resource_format_binary.cpp6
-rw-r--r--core/variant.h4
-rw-r--r--core/variant_op.cpp31
-rw-r--r--core/variant_parser.cpp66
6 files changed, 28 insertions, 93 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index 3098df421a..18f34b5d37 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -506,21 +506,21 @@ static _GlobalConstant _global_constants[] = {
{ "TYPE_TRANSFORM2D", Variant::TRANSFORM2D },
{ "TYPE_PLANE", Variant::PLANE },
{ "TYPE_QUAT", Variant::QUAT }, // 10
- { "TYPE_RECT3", Variant::RECT3 }, //sorry naming convention fail :( not like it's used often
+ { "TYPE_RECT3", Variant::RECT3 },
{ "TYPE_BASIS", Variant::BASIS },
{ "TYPE_TRANSFORM", Variant::TRANSFORM },
{ "TYPE_COLOR", Variant::COLOR },
- { "TYPE_NODE_PATH", Variant::NODE_PATH },
+ { "TYPE_NODE_PATH", Variant::NODE_PATH }, // 15
{ "TYPE_RID", Variant::_RID },
{ "TYPE_OBJECT", Variant::OBJECT },
{ "TYPE_INPUT_EVENT", Variant::INPUT_EVENT },
- { "TYPE_DICTIONARY", Variant::DICTIONARY }, // 20
- { "TYPE_ARRAY", Variant::ARRAY },
+ { "TYPE_DICTIONARY", Variant::DICTIONARY },
+ { "TYPE_ARRAY", Variant::ARRAY }, // 20
{ "TYPE_RAW_ARRAY", Variant::POOL_BYTE_ARRAY },
{ "TYPE_INT_ARRAY", Variant::POOL_INT_ARRAY },
{ "TYPE_REAL_ARRAY", Variant::POOL_REAL_ARRAY },
- { "TYPE_STRING_ARRAY", Variant::POOL_STRING_ARRAY }, // 25
- { "TYPE_VECTOR2_ARRAY", Variant::POOL_VECTOR2_ARRAY },
+ { "TYPE_STRING_ARRAY", Variant::POOL_STRING_ARRAY },
+ { "TYPE_VECTOR2_ARRAY", Variant::POOL_VECTOR2_ARRAY }, // 25
{ "TYPE_VECTOR3_ARRAY", Variant::POOL_VECTOR3_ARRAY },
{ "TYPE_COLOR_ARRAY", Variant::POOL_COLOR_ARRAY },
{ "TYPE_MAX", Variant::VARIANT_MAX },
diff --git a/core/image.cpp b/core/image.cpp
index a490c06275..85ca63be5e 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -1960,7 +1960,7 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mipmap_offset", "mipmap"), &Image::get_mipmap_offset);
ClassDB::bind_method(D_METHOD("resize_to_po2", "square"), &Image::resize_to_po2, DEFVAL("false"));
- ClassDB::bind_method(D_METHOD("resize", "width", "height", "interpolation"), &Image::resize_to_po2, DEFVAL(INTERPOLATE_BILINEAR));
+ ClassDB::bind_method(D_METHOD("resize", "width", "height", "interpolation"), &Image::resize, DEFVAL(INTERPOLATE_BILINEAR));
ClassDB::bind_method(D_METHOD("shrink_x2"), &Image::shrink_x2);
ClassDB::bind_method(D_METHOD("expand_x2_hq2x"), &Image::expand_x2_hq2x);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index d6e2925d57..4ad3d261b2 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -49,7 +49,7 @@ enum {
VARIANT_VECTOR3 = 12,
VARIANT_PLANE = 13,
VARIANT_QUAT = 14,
- VARIANT_AABB = 15,
+ VARIANT_RECT3 = 15,
VARIANT_MATRIX3 = 16,
VARIANT_TRANSFORM = 17,
VARIANT_MATRIX32 = 18,
@@ -188,7 +188,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
r_v = v;
} break;
- case VARIANT_AABB: {
+ case VARIANT_RECT3: {
Rect3 v;
v.pos.x = f->get_real();
@@ -1332,7 +1332,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant &p_property,
} break;
case Variant::RECT3: {
- f->store_32(VARIANT_AABB);
+ f->store_32(VARIANT_RECT3);
Rect3 val = p_property;
f->store_real(val.pos.x);
f->store_real(val.pos.y);
diff --git a/core/variant.h b/core/variant.h
index 021f1d0144..76097dfbdd 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -91,13 +91,13 @@ public:
TRANSFORM2D,
PLANE,
QUAT, // 10
- RECT3, //sorry naming convention fail :( not like it's used often
+ RECT3,
BASIS,
TRANSFORM,
// misc types
COLOR,
- NODE_PATH,
+ NODE_PATH, // 15
_RID,
OBJECT,
INPUT_EVENT,
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 1de46a07eb..8bae6a168b 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1303,7 +1303,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
}
}
- } break;
+ } break; // 10
case RECT3: {
if (p_value.type != Variant::VECTOR3)
@@ -1328,7 +1328,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
return;
}
}
- } break; //sorry naming convention fail :( not like it's used often // 10
+ } break;
case BASIS: {
if (p_value.type != Variant::VECTOR3)
@@ -1896,13 +1896,13 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
dic->operator[](p_index) = p_value;
valid = true; //always valid, i guess? should this really be ok?
return;
- } break; // 20
- DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return )
+ } break;
+ DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return ) // 20
DEFAULT_OP_DVECTOR_SET(POOL_BYTE_ARRAY, uint8_t, p_value.type != Variant::REAL && p_value.type != Variant::INT)
DEFAULT_OP_DVECTOR_SET(POOL_INT_ARRAY, int, p_value.type != Variant::REAL && p_value.type != Variant::INT)
DEFAULT_OP_DVECTOR_SET(POOL_REAL_ARRAY, real_t, p_value.type != Variant::REAL && p_value.type != Variant::INT)
- DEFAULT_OP_DVECTOR_SET(POOL_STRING_ARRAY, String, p_value.type != Variant::STRING) // 25
- DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2)
+ DEFAULT_OP_DVECTOR_SET(POOL_STRING_ARRAY, String, p_value.type != Variant::STRING)
+ DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) // 25
DEFAULT_OP_DVECTOR_SET(POOL_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3)
DEFAULT_OP_DVECTOR_SET(POOL_COLOR_ARRAY, Color, p_value.type != Variant::COLOR)
default: return;
@@ -2103,7 +2103,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
}
}
- } break;
+ } break; // 10
case RECT3: {
if (p_index.get_type() == Variant::STRING) {
@@ -2122,7 +2122,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
return v->size + v->pos;
}
}
- } break; //sorry naming convention fail :( not like it's used often // 10
+ } break;
case BASIS: {
if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) {
@@ -2498,13 +2498,13 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
valid = true;
return *res;
}
- } break; // 20
- DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index])
+ } break;
+ DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index]) // 20
DEFAULT_OP_DVECTOR_GET(POOL_BYTE_ARRAY, uint8_t)
DEFAULT_OP_DVECTOR_GET(POOL_INT_ARRAY, int)
DEFAULT_OP_DVECTOR_GET(POOL_REAL_ARRAY, real_t)
DEFAULT_OP_DVECTOR_GET(POOL_STRING_ARRAY, String)
- DEFAULT_OP_DVECTOR_GET(POOL_VECTOR2_ARRAY, Vector2)
+ DEFAULT_OP_DVECTOR_GET(POOL_VECTOR2_ARRAY, Vector2) // 25
DEFAULT_OP_DVECTOR_GET(POOL_VECTOR3_ARRAY, Vector3)
DEFAULT_OP_DVECTOR_GET(POOL_COLOR_ARRAY, Color)
default: return Variant();
@@ -2768,12 +2768,12 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::REAL, "z"));
p_list->push_back(PropertyInfo(Variant::REAL, "w"));
- } break;
+ } break; // 10
case RECT3: {
p_list->push_back(PropertyInfo(Variant::VECTOR3, "pos"));
p_list->push_back(PropertyInfo(Variant::VECTOR3, "size"));
p_list->push_back(PropertyInfo(Variant::VECTOR3, "end"));
- } break; //sorry naming convention fail :( not like it's used often // 10
+ } break;
case BASIS: {
p_list->push_back(PropertyInfo(Variant::VECTOR3, "x"));
@@ -2921,12 +2921,13 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::STRING, E->get()));
}
}
- } break; // 20
- case ARRAY:
+ } break;
+ case ARRAY: // 20
case POOL_BYTE_ARRAY:
case POOL_INT_ARRAY:
case POOL_REAL_ARRAY:
case POOL_STRING_ARRAY:
+ case POOL_VECTOR2_ARRAY: // 25
case POOL_VECTOR3_ARRAY:
case POOL_COLOR_ARRAY: {
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index f650e5f833..798a830dd0 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -504,39 +504,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return OK;
} else if (token.type == TK_IDENTIFIER) {
- /*
- VECTOR2, // 5
- RECT2,
- VECTOR3,
- MATRIX32,
- PLANE,
- QUAT, // 10
- _AABB, //sorry naming convention fail :( not like it's used often
- MATRIX3,
- TRANSFORM,
- // misc types
- COLOR,
- IMAGE, // 15
- NODE_PATH,
- _RID,
- OBJECT,
- INPUT_EVENT,
- DICTIONARY, // 20
- ARRAY,
-
- // arrays
- RAW_ARRAY,
- INT_ARRAY,
- REAL_ARRAY,
- STRING_ARRAY, // 25
- VECTOR2_ARRAY,
- VECTOR3_ARRAY,
- COLOR_ARRAY,
-
- VARIANT_MAX
-
-*/
String id = token.value;
if (id == "true")
value = true;
@@ -1243,40 +1211,6 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- /*
- VECTOR2, // 5
- RECT2,
- VECTOR3,
- MATRIX32,
- PLANE,
- QUAT, // 10
- _AABB, //sorry naming convention fail :( not like it's used often
- MATRIX3,
- TRANSFORM,
-
- // misc types
- COLOR,
- IMAGE, // 15
- NODE_PATH,
- _RID,
- OBJECT,
- INPUT_EVENT,
- DICTIONARY, // 20
- ARRAY,
-
- // arrays
- RAW_ARRAY,
- INT_ARRAY,
- REAL_ARRAY,
- STRING_ARRAY, // 25
- VECTOR2_ARRAY,
- VECTOR3_ARRAY,
- COLOR_ARRAY,
-
- VARIANT_MAX
-
- */
-
return OK;
} else if (token.type == TK_NUMBER) {