MCPcopy Create free account
hub / github.com/defold/defold / LuaSetEuler

Function LuaSetEuler

engine/gui/src/gui_script.cpp:4386–4416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4384 }
4385
4386 int LuaSetEuler(lua_State* L)
4387 {
4388 HNode hnode;
4389 InternalNode* n = LuaCheckNodeInternal(L, 1, &hnode);
4390 if (n->m_Node.m_IsBone) {
4391 return 0;
4392 }
4393 Quat r;
4394 Vector4 v;
4395 Vector3* v3;
4396 Vector4* v4;
4397 if ((v3 = dmScript::ToVector3(L, 2)))
4398 {
4399 v = Vector4(*v3, 0.0f);
4400 r = dmVMath::EulerToQuat(v.getXYZ());
4401 }
4402 else if ((v4 = dmScript::ToVector4(L, 2)))
4403 {
4404 v = *v4;
4405 r = dmVMath::EulerToQuat(v.getXYZ());
4406 }
4407 else
4408 {
4409 return luaL_argerror(L, 2, "Valid types are vmath.vector3 and vmath.vector4");
4410 }
4411
4412 n->m_Node.m_Properties[PROPERTY_ROTATION] = Vector4(r);
4413 n->m_Node.m_Properties[PROPERTY_EULER] = v;
4414 n->m_Node.m_DirtyLocal = 1;
4415 return 0;
4416 }
4417
4418 void SetDefaultNewContextParams(NewContextParams* params)
4419 {

Callers

nothing calls this directly

Calls 7

LuaCheckNodeInternalFunction · 0.85
ToVector3Function · 0.85
ToVector4Function · 0.85
luaL_argerrorFunction · 0.85
Vector4Class · 0.50
EulerToQuatFunction · 0.50
getXYZMethod · 0.45

Tested by

no test coverage detected