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

Function LuaSetSize

engine/gui/src/gui_script.cpp:4436–4462  ·  view source on GitHub ↗

sets the node size * * Sets the size of the supplied node. * * [icon:attention] You can only set size on nodes with size mode set to SIZE_MODE_MANUAL * * @name gui.set_size * @param node [type:node] node to set the size for * @param size [type:vector3|vector4] new size */

Source from the content-addressed store, hash-verified

4434 * @param size [type:vector3|vector4] new size
4435 */
4436 int LuaSetSize(lua_State* L)
4437 {
4438 HNode hnode;
4439 InternalNode* n = LuaCheckNodeInternal(L, 1, &hnode);
4440 if(n->m_Node.m_SizeMode != SIZE_MODE_MANUAL)
4441 {
4442 dmLogWarning("Can not set size on auto-sized nodes.");
4443 return 0;
4444 }
4445 if(n->m_Node.m_IsBone)
4446 {
4447 return 0;
4448 }
4449 Vector3* v3;
4450 Vector4 v;
4451 if ((v3 = dmScript::ToVector3(L, 2)))
4452 {
4453 Scene* scene = GetScene(L);
4454 Vector4 original = dmGui::GetNodeProperty(scene, hnode, PROPERTY_SIZE);
4455 v = Vector4(*v3, original.getW());
4456 }
4457 else
4458 v = *dmScript::CheckVector4(L, 2);
4459 n->m_Node.m_Properties[PROPERTY_SIZE] = v;
4460 n->m_Node.m_DirtyLocal = 1;
4461 return 0;
4462 }
4463
4464 /*# gets the node size
4465 * Returns the size of the supplied node.

Callers

nothing calls this directly

Calls 7

LuaCheckNodeInternalFunction · 0.85
ToVector3Function · 0.85
GetSceneFunction · 0.85
CheckVector4Function · 0.85
GetNodePropertyFunction · 0.70
Vector4Class · 0.50
getWMethod · 0.45

Tested by

no test coverage detected