From fdaa2920eb21fff3320a17e9239e04dfadecdb00 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 18 Apr 2015 14:38:54 -0300 Subject: Updated copyright year in all headers --- core/variant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/variant.cpp') diff --git a/core/variant.cpp b/core/variant.cpp index 667a7d8648..a85f288620 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ -- cgit v1.2.3 From 1f8e3117dd8643b9c6d6127a891a0f4673479fa2 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 24 Apr 2015 20:45:07 -0300 Subject: Ability to convert from nodes or other non resource with a get_rid() function to a rid --- core/variant.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'core/variant.cpp') diff --git a/core/variant.cpp b/core/variant.cpp index a85f288620..e0c4b4244d 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -32,7 +32,7 @@ #include "scene/main/node.h" #include "scene/gui/control.h" #include "io/marshalls.h" - +#include "core_string_names.h" @@ -1430,8 +1430,16 @@ Variant::operator RID() const { return *reinterpret_cast(_data._mem); else if (type==OBJECT && !_get_obj().ref.is_null()) { return _get_obj().ref.get_rid(); - } else + } else if (type==OBJECT && _get_obj().obj) { + Variant::CallError ce; + Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid,NULL,0,ce); + if (ce.error==Variant::CallError::CALL_OK && ret.get_type()==Variant::_RID) { + return ret; + } return RID(); + } else { + return RID(); + } } Variant::operator Object*() const { -- cgit v1.2.3 From b2b514367824263e2dc1e26b010b0df63fd3700a Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 1 May 2015 02:53:41 +0200 Subject: Sort xml files, so order is constant Makes xml format work better with version control systems. --- core/variant.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/variant.cpp') diff --git a/core/variant.cpp b/core/variant.cpp index e0c4b4244d..fe6a6b3e4f 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -456,6 +456,15 @@ bool Variant::operator==(const Variant& p_variant) const { } +bool Variant::operator<(const Variant& p_variant) const { + if (type!=p_variant.type) //if types differ, then order by type first + return type