mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Do not render selection's bounding box when any gizmo is active
This commit is contained in:
		
							parent
							
								
									0810beae77
								
							
						
					
					
						commit
						4f0869730a
					
				
					 2 changed files with 4 additions and 60 deletions
				
			
		|  | @ -1703,17 +1703,13 @@ void GLCanvas3D::Selection::translate(unsigned int object_idx, unsigned int inst | |||
|     m_bounding_box_dirty = true; | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::Selection::render(bool show_indirect_selection) const | ||||
| void GLCanvas3D::Selection::render() const | ||||
| { | ||||
|     if (is_empty()) | ||||
|         return; | ||||
| 
 | ||||
|     // render cumulative bounding box of selected volumes
 | ||||
|     _render_selected_volumes(); | ||||
| 
 | ||||
|     // render bounding boxes of indirectly selected instances
 | ||||
|     if (show_indirect_selection && (m_mode == Instance)) | ||||
|         _render_unselected_instances(); | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::Selection::_update_valid() | ||||
|  | @ -1912,56 +1908,6 @@ void GLCanvas3D::Selection::_render_selected_volumes() const | |||
|     _render_bounding_box(get_bounding_box(), color); | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::Selection::_render_unselected_instances() const | ||||
| { | ||||
|     std::set<unsigned int> done;  // prevent processing volumes twice
 | ||||
|     done.insert(m_list.begin(), m_list.end()); | ||||
| 
 | ||||
|     typedef std::map<std::pair<int, int>, BoundingBoxf3> InstanceToBoxMap; | ||||
|     InstanceToBoxMap boxes; | ||||
|     for (unsigned int i : m_list) | ||||
|     { | ||||
|         if (done.size() == m_volumes->size()) | ||||
|             break; | ||||
| 
 | ||||
|         const GLVolume* volume = (*m_volumes)[i]; | ||||
|         int object_idx = volume->object_idx(); | ||||
|         if (object_idx >= 1000) | ||||
|             continue; | ||||
| 
 | ||||
|         int instance_idx = volume->instance_idx(); | ||||
| 
 | ||||
|         for (unsigned int j = 0; j < (unsigned int)m_volumes->size(); ++j) | ||||
|         { | ||||
|             if (done.size() == m_volumes->size()) | ||||
|                 break; | ||||
| 
 | ||||
|             if (done.find(j) != done.end()) | ||||
|                 continue; | ||||
| 
 | ||||
|             GLVolume* v = (*m_volumes)[j]; | ||||
|             int i_idx = v->instance_idx(); | ||||
|             if ((v->object_idx() != object_idx) || (i_idx == instance_idx)) | ||||
|                 continue; | ||||
| 
 | ||||
|             std::pair<int, int> box_id(object_idx, i_idx); | ||||
|             InstanceToBoxMap::iterator it = boxes.find(box_id); | ||||
|             if (it == boxes.end()) | ||||
|                 it = boxes.insert(InstanceToBoxMap::value_type(box_id, BoundingBoxf3())).first; | ||||
| 
 | ||||
|             it->second.merge(v->transformed_convex_hull_bounding_box()); | ||||
| 
 | ||||
|             done.insert(j); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     float color[3] = { 1.0f, 1.0f, 0.0f }; | ||||
|     for (const InstanceToBoxMap::value_type& box : boxes) | ||||
|     { | ||||
|         _render_bounding_box(box.second, color); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::Selection::_render_bounding_box(const BoundingBoxf3& box, float* color) const | ||||
| { | ||||
|     if (color == nullptr) | ||||
|  | @ -4798,9 +4744,8 @@ void GLCanvas3D::_render_objects() const | |||
| 
 | ||||
| void GLCanvas3D::_render_selection() const | ||||
| { | ||||
|     Gizmos::EType type = m_gizmos.get_current_type(); | ||||
|     bool show_indirect_selection = m_gizmos.is_running() && ((type == Gizmos::Rotate) || (type == Gizmos::Scale) || (type == Gizmos::Flatten)); | ||||
|     m_selection.render(show_indirect_selection); | ||||
|     if (!m_gizmos.is_running()) | ||||
|         m_selection.render(); | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::_render_cutting_plane() const | ||||
|  |  | |||
|  | @ -517,7 +517,7 @@ public: | |||
|         void translate(unsigned int object_idx, const Vec3d& displacement); | ||||
|         void translate(unsigned int object_idx, unsigned int instance_idx, const Vec3d& displacement); | ||||
| 
 | ||||
|         void render(bool show_indirect_selection) const; | ||||
|         void render() const; | ||||
| 
 | ||||
|     private: | ||||
|         void _update_valid(); | ||||
|  | @ -531,7 +531,6 @@ public: | |||
|         void _remove_object(unsigned int object_idx); | ||||
|         void _calc_bounding_box() const; | ||||
|         void _render_selected_volumes() const; | ||||
|         void _render_unselected_instances() const; | ||||
|         void _render_bounding_box(const BoundingBoxf3& box, float* color) const; | ||||
|         void _synchronize_unselected_instances(); | ||||
|     }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri