1 /**
2 Skeleton for 2D characters and animated objects.
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.skeleton2d;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.classdb;
24 import godot.node2d;
25 import godot.canvasitem;
26 import godot.node;
27 import godot.bone2d;
28 /**
29 Skeleton for 2D characters and animated objects.
30 
31 Skeleton2D parents a hierarchy of $(D Bone2D) objects. It is a requirement of $(D Bone2D). Skeleton2D holds a reference to the rest pose of its children and acts as a single point of access to its bones.
32 */
33 @GodotBaseClass struct Skeleton2D
34 {
35 	package(godot) enum string _GODOT_internal_name = "Skeleton2D";
36 public:
37 @nogc nothrow:
38 	union { /** */ godot_object _godot_object; /** */ Node2D _GODOT_base; }
39 	alias _GODOT_base this;
40 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
41 	package(godot) __gshared bool _classBindingInitialized = false;
42 	package(godot) static struct GDNativeClassBinding
43 	{
44 		__gshared:
45 		@GodotName("_update_bone_setup") GodotMethod!(void) _updateBoneSetup;
46 		@GodotName("_update_transform") GodotMethod!(void) _updateTransform;
47 		@GodotName("get_bone") GodotMethod!(Bone2D, long) getBone;
48 		@GodotName("get_bone_count") GodotMethod!(long) getBoneCount;
49 		@GodotName("get_skeleton") GodotMethod!(RID) getSkeleton;
50 	}
51 	/// 
52 	pragma(inline, true) bool opEquals(in Skeleton2D other) const
53 	{ return _godot_object.ptr is other._godot_object.ptr; }
54 	/// 
55 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
56 	{ _godot_object.ptr = n; return null; }
57 	/// 
58 	pragma(inline, true) bool opEquals(typeof(null) n) const
59 	{ return _godot_object.ptr is n; }
60 	/// 
61 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
62 	mixin baseCasts;
63 	/// Construct a new instance of Skeleton2D.
64 	/// Note: use `memnew!Skeleton2D` instead.
65 	static Skeleton2D _new()
66 	{
67 		static godot_class_constructor constructor;
68 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Skeleton2D");
69 		if(constructor is null) return typeof(this).init;
70 		return cast(Skeleton2D)(constructor());
71 	}
72 	@disable new(size_t s);
73 	/**
74 	
75 	*/
76 	void _updateBoneSetup()
77 	{
78 		Array _GODOT_args = Array.make();
79 		String _GODOT_method_name = String("_update_bone_setup");
80 		this.callv(_GODOT_method_name, _GODOT_args);
81 	}
82 	/**
83 	
84 	*/
85 	void _updateTransform()
86 	{
87 		Array _GODOT_args = Array.make();
88 		String _GODOT_method_name = String("_update_transform");
89 		this.callv(_GODOT_method_name, _GODOT_args);
90 	}
91 	/**
92 	Returns a $(D Bone2D) from the node hierarchy parented by Skeleton2D. The object to return is identified by the parameter `idx`. Bones are indexed by descending the node hierarchy from top to bottom, adding the children of each branch before moving to the next sibling.
93 	*/
94 	Bone2D getBone(in long idx)
95 	{
96 		checkClassBinding!(typeof(this))();
97 		return ptrcall!(Bone2D)(GDNativeClassBinding.getBone, _godot_object, idx);
98 	}
99 	/**
100 	Returns the number of $(D Bone2D) nodes in the node hierarchy parented by Skeleton2D.
101 	*/
102 	long getBoneCount() const
103 	{
104 		checkClassBinding!(typeof(this))();
105 		return ptrcall!(long)(GDNativeClassBinding.getBoneCount, _godot_object);
106 	}
107 	/**
108 	Returns the $(D RID) of a Skeleton2D instance.
109 	*/
110 	RID getSkeleton() const
111 	{
112 		checkClassBinding!(typeof(this))();
113 		return ptrcall!(RID)(GDNativeClassBinding.getSkeleton, _godot_object);
114 	}
115 }