Added method int GLCanvas3D::get_in_object_volume_id(int scene_vol_idx) const

This commit is contained in:
Enrico Turri 2018-09-13 16:09:46 +02:00
parent bef19fe6da
commit b779c6492e
7 changed files with 28 additions and 0 deletions

View File

@ -2164,6 +2164,11 @@ int _3DScene::get_first_volume_id(wxGLCanvas* canvas, int obj_idx)
return s_canvas_mgr.get_first_volume_id(canvas, obj_idx); return s_canvas_mgr.get_first_volume_id(canvas, obj_idx);
} }
int _3DScene::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx)
{
return s_canvas_mgr.get_in_object_volume_id(canvas, scene_vol_idx);
}
void _3DScene::reload_scene(wxGLCanvas* canvas, bool force) void _3DScene::reload_scene(wxGLCanvas* canvas, bool force)
{ {
s_canvas_mgr.reload_scene(canvas, force); s_canvas_mgr.reload_scene(canvas, force);

View File

@ -577,6 +577,7 @@ public:
static std::vector<int> load_object(wxGLCanvas* canvas, const Model* model, int obj_idx); static std::vector<int> load_object(wxGLCanvas* canvas, const Model* model, int obj_idx);
static int get_first_volume_id(wxGLCanvas* canvas, int obj_idx); static int get_first_volume_id(wxGLCanvas* canvas, int obj_idx);
static int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx);
static void reload_scene(wxGLCanvas* canvas, bool force); static void reload_scene(wxGLCanvas* canvas, bool force);

View File

@ -2493,6 +2493,11 @@ int GLCanvas3D::get_first_volume_id(int obj_idx) const
return -1; return -1;
} }
int GLCanvas3D::get_in_object_volume_id(int scene_vol_idx) const
{
return ((0 <= scene_vol_idx) && (scene_vol_idx < (int)m_volumes.volumes.size())) ? m_volumes.volumes[scene_vol_idx]->volume_idx() : -1;
}
void GLCanvas3D::reload_scene(bool force) void GLCanvas3D::reload_scene(bool force)
{ {
if ((m_canvas == nullptr) || (m_config == nullptr) || (m_model == nullptr)) if ((m_canvas == nullptr) || (m_config == nullptr) || (m_model == nullptr))

View File

@ -603,6 +603,7 @@ public:
std::vector<int> load_object(const Model& model, int obj_idx); std::vector<int> load_object(const Model& model, int obj_idx);
int get_first_volume_id(int obj_idx) const; int get_first_volume_id(int obj_idx) const;
int get_in_object_volume_id(int scene_vol_idx) const;
void reload_scene(bool force); void reload_scene(bool force);

View File

@ -548,6 +548,12 @@ int GLCanvas3DManager::get_first_volume_id(wxGLCanvas* canvas, int obj_idx) cons
return (it != m_canvases.end()) ? it->second->get_first_volume_id(obj_idx) : -1; return (it != m_canvases.end()) ? it->second->get_first_volume_id(obj_idx) : -1;
} }
int GLCanvas3DManager::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx) const
{
CanvasesMap::const_iterator it = _get_canvas(canvas);
return (it != m_canvases.end()) ? it->second->get_in_object_volume_id(scene_vol_idx) : -1;
}
void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool force) void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool force)
{ {
CanvasesMap::iterator it = _get_canvas(canvas); CanvasesMap::iterator it = _get_canvas(canvas);

View File

@ -138,6 +138,7 @@ public:
std::vector<int> load_object(wxGLCanvas* canvas, const Model* model, int obj_idx); std::vector<int> load_object(wxGLCanvas* canvas, const Model* model, int obj_idx);
int get_first_volume_id(wxGLCanvas* canvas, int obj_idx) const; int get_first_volume_id(wxGLCanvas* canvas, int obj_idx) const;
int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx) const;
void reload_scene(wxGLCanvas* canvas, bool force); void reload_scene(wxGLCanvas* canvas, bool force);

View File

@ -767,6 +767,15 @@ get_first_volume_id(canvas, obj_idx)
OUTPUT: OUTPUT:
RETVAL RETVAL
int
get_in_object_volume_id(canvas, scene_vol_idx)
SV *canvas;
int scene_vol_idx;
CODE:
RETVAL = _3DScene::get_in_object_volume_id((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), scene_vol_idx);
OUTPUT:
RETVAL
std::vector<int> std::vector<int>
load_model(canvas, model, obj_idx) load_model(canvas, model, obj_idx)
SV *canvas; SV *canvas;