소스 검색

Merge pull request #270 from Windfisch/add-variant-cast

Add a type conversion to Variant for anything that supports ___get_from_variant()
Bastiaan Olij 6 년 전
부모
커밋
12732b5391
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      include/core/Variant.hpp

+ 1 - 0
include/core/Variant.hpp

@@ -226,6 +226,7 @@ public:
 	operator NodePath() const;
 	operator RID() const;
 	operator godot_object *() const;
+	template <typename T> operator T*() const { return static_cast<T*>(T::___get_from_variant(*this)); }
 
 	operator Dictionary() const;
 	operator Array() const;