mirror of
https://github.com/Relintai/godot-lportal.git
synced 2024-11-23 05:17:20 +01:00
Added option to use Godot hide instead of detach from scene tree
This commit is contained in:
parent
46371dbe63
commit
1fcdeaa0e5
22
ldob.cpp
22
ldob.cpp
@ -27,6 +27,8 @@
|
||||
#include "scene/3d/light.h"
|
||||
|
||||
|
||||
bool LHidable::m_bDetach = true;
|
||||
|
||||
void LHidable::Hidable_Create(Node * pNode)
|
||||
{
|
||||
// m_pNode = 0; m_pParent = 0; m_bShow = true;
|
||||
@ -47,15 +49,25 @@ void LHidable::Show(bool bShow)
|
||||
|
||||
assert (m_pParent);
|
||||
|
||||
if (bShow)
|
||||
if (m_bDetach)
|
||||
{
|
||||
// add to tree
|
||||
m_pParent->add_child(m_pNode);
|
||||
if (bShow)
|
||||
{
|
||||
// add to tree
|
||||
m_pParent->add_child(m_pNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove from tree
|
||||
m_pParent->remove_child(m_pNode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove from tree
|
||||
m_pParent->remove_child(m_pNode);
|
||||
if (bShow)
|
||||
((Spatial *) m_pNode)->show();
|
||||
else
|
||||
((Spatial *) m_pNode)->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
3
ldob.h
3
ldob.h
@ -43,6 +43,9 @@ public:
|
||||
|
||||
// separate flag so we don't have to touch the godot lookup
|
||||
bool m_bShow;
|
||||
|
||||
// which method we are using to show and hide .. detaching from scene tree or just show / hide through godot
|
||||
static bool m_bDetach;
|
||||
};
|
||||
|
||||
// static object
|
||||
|
@ -1232,6 +1232,12 @@ bool LRoomManager::rooms_single_room_convert(bool bVerbose, bool bDeleteLights)
|
||||
}
|
||||
|
||||
|
||||
void LRoomManager::rooms_set_hide_method_detach(bool bDetach)
|
||||
{
|
||||
LHidable::m_bDetach = bDetach;
|
||||
}
|
||||
|
||||
|
||||
void LRoomManager::rooms_set_portal_plane_convention(bool bFlip)
|
||||
{
|
||||
m_bPortalPlane_Convention = bFlip;
|
||||
@ -2004,6 +2010,8 @@ void LRoomManager::_bind_methods()
|
||||
ClassDB::bind_method(D_METHOD("rooms_single_room_convert", "verbose", "delete lights"), &LRoomManager::rooms_single_room_convert);
|
||||
ClassDB::bind_method(D_METHOD("rooms_set_portal_plane_convention", "flip"), &LRoomManager::rooms_set_portal_plane_convention);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("rooms_set_hide_method_detach", "detach"), &LRoomManager::rooms_set_hide_method_detach);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("rooms_release"), &LRoomManager::rooms_release);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("rooms_set_camera", "camera"), &LRoomManager::rooms_set_camera);
|
||||
|
@ -60,7 +60,6 @@ public:
|
||||
// convert empties and meshes to rooms and portals
|
||||
bool rooms_convert(bool bVerbose, bool bDeleteLights);
|
||||
bool rooms_single_room_convert(bool bVerbose, bool bDeleteLights);
|
||||
void rooms_set_portal_plane_convention(bool bFlip);
|
||||
// free memory for current set of rooms, prepare for converting a new game level
|
||||
void rooms_release();
|
||||
|
||||
@ -72,6 +71,10 @@ public:
|
||||
// (can be used to find the name etc of a room ID returned by dob_update)
|
||||
Node * rooms_get_room(int room_id);
|
||||
|
||||
// CONVENTIONS
|
||||
void rooms_set_portal_plane_convention(bool bFlip);
|
||||
void rooms_set_hide_method_detach(bool bDetach);
|
||||
|
||||
//______________________________________________________________________________________
|
||||
// DOBS
|
||||
// Dynamic objects .. cameras, players, boxes etc
|
||||
|
Loading…
Reference in New Issue
Block a user