creates a new particle fx node * Dynamically create a particle fx node. * * @name gui.new_particlefx_node * @param pos [type:vector3|vector4] node position * @param particlefx [type:hash|string] particle fx resource name * @return node [type:node] new particle fx node */
| 4645 | * @return node [type:node] new particle fx node |
| 4646 | */ |
| 4647 | static int LuaNewParticlefxNode(lua_State* L) |
| 4648 | { |
| 4649 | DM_LUA_STACK_CHECK(L, 1); |
| 4650 | |
| 4651 | Point3 pos = GetPositionFromArgumentIndex(L, 1); |
| 4652 | dmhash_t particlefx = dmScript::CheckHashOrString(L, 2); |
| 4653 | Scene* scene = GuiScriptInstance_Check(L); |
| 4654 | |
| 4655 | // The default size comes from the CalculateNodeExtents() |
| 4656 | HNode node = dmGui::NewNode(scene, pos, Vector3(1,1,0), NODE_TYPE_PARTICLEFX, 0); |
| 4657 | if (!node) |
| 4658 | { |
| 4659 | return DM_LUA_ERROR("Out of nodes (max %d)", scene->m_Nodes.Capacity()); |
| 4660 | } |
| 4661 | |
| 4662 | dmGui::Result r = dmGui::SetNodeParticlefx(scene, node, particlefx); |
| 4663 | if (r == RESULT_RESOURCE_NOT_FOUND) { |
| 4664 | char name[128]; |
| 4665 | return DM_LUA_ERROR("No particlefx resource '%s' found.", dmScript::GetStringFromHashOrString(L, 2, name, sizeof(name))); |
| 4666 | } |
| 4667 | LuaPushNode(L, scene, node); |
| 4668 | return 1; |
| 4669 | } |
| 4670 | |
| 4671 | // Only used locally here in this file |
| 4672 | struct GuiLuaCallback |
nothing calls this directly
no test coverage detected