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 */
| 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. |
nothing calls this directly
no test coverage detected