mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	merge with master
This commit is contained in:
		
						commit
						9996369e2c
					
				
					 2 changed files with 12 additions and 4 deletions
				
			
		|  | @ -1075,6 +1075,7 @@ GLCanvas3D::Selection::VolumeCache::TransformCache::TransformCache() | ||||||
|     , scaling_factor(Vec3d::Ones()) |     , scaling_factor(Vec3d::Ones()) | ||||||
|     , rotation_matrix(Transform3d::Identity()) |     , rotation_matrix(Transform3d::Identity()) | ||||||
|     , scale_matrix(Transform3d::Identity()) |     , scale_matrix(Transform3d::Identity()) | ||||||
|  |     , no_position_matrix(Transform3d::Identity()) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1085,6 +1086,7 @@ GLCanvas3D::Selection::VolumeCache::TransformCache::TransformCache(const Geometr | ||||||
| { | { | ||||||
|     rotation_matrix = Geometry::assemble_transform(Vec3d::Zero(), rotation); |     rotation_matrix = Geometry::assemble_transform(Vec3d::Zero(), rotation); | ||||||
|     scale_matrix = Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), scaling_factor); |     scale_matrix = Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), scaling_factor); | ||||||
|  |     no_position_matrix = transform.get_matrix(true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| GLCanvas3D::Selection::VolumeCache::VolumeCache(const Geometry::Transformation& volume_transform, const Geometry::Transformation& instance_transform) | GLCanvas3D::Selection::VolumeCache::VolumeCache(const Geometry::Transformation& volume_transform, const Geometry::Transformation& instance_transform) | ||||||
|  | @ -1437,7 +1439,10 @@ void GLCanvas3D::Selection::translate(const Vec3d& displacement) | ||||||
|         if (m_mode == Instance) |         if (m_mode == Instance) | ||||||
|             (*m_volumes)[i]->set_instance_offset(m_cache.volumes_data[i].get_instance_position() + displacement); |             (*m_volumes)[i]->set_instance_offset(m_cache.volumes_data[i].get_instance_position() + displacement); | ||||||
|         else if (m_mode == Volume) |         else if (m_mode == Volume) | ||||||
|             (*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement); |         { | ||||||
|  |             Vec3d local_displacement = (m_cache.volumes_data[i].get_instance_no_position_matrix() * m_cache.volumes_data[i].get_volume_no_position_matrix()).inverse() * displacement; | ||||||
|  |             (*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + local_displacement); | ||||||
|  |         } | ||||||
| #else | #else | ||||||
|         (*m_volumes)[i]->set_offset(m_cache.volumes_data[i].get_position() + displacement); |         (*m_volumes)[i]->set_offset(m_cache.volumes_data[i].get_position() + displacement); | ||||||
| #endif // ENABLE_MODELVOLUME_TRANSFORM
 | #endif // ENABLE_MODELVOLUME_TRANSFORM
 | ||||||
|  | @ -4323,6 +4328,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | ||||||
|             m_dirty = true; |             m_dirty = true; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  | #if !ENABLE_WORLD_ROTATIONS | ||||||
|         case Gizmos::Rotate: |         case Gizmos::Rotate: | ||||||
|         { |         { | ||||||
|             m_selection.rotate(m_gizmos.get_rotation(), false); |             m_selection.rotate(m_gizmos.get_rotation(), false); | ||||||
|  | @ -4331,6 +4337,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | ||||||
|             m_dirty = true; |             m_dirty = true; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  | #endif // !ENABLE_WORLD_ROTATIONS
 | ||||||
|         default: |         default: | ||||||
|         { |         { | ||||||
|             break; |             break; | ||||||
|  | @ -4501,9 +4508,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | ||||||
|         // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag
 |         // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag
 | ||||||
|         Vec3d cur_pos = m_selection.contains_volume(m_hover_volume_id) ? Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2)) : m_mouse.drag.start_position_3D; |         Vec3d cur_pos = m_selection.contains_volume(m_hover_volume_id) ? Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2)) : m_mouse.drag.start_position_3D; | ||||||
| 
 | 
 | ||||||
|         // Calculate the translation vector.
 |         m_selection.translate(cur_pos - m_mouse.drag.start_position_3D); | ||||||
|         Vec3d displacement = cur_pos - m_mouse.drag.start_position_3D; |  | ||||||
|         m_selection.translate(displacement); |  | ||||||
|         wxGetApp().obj_manipul()->update_settings_value(m_selection); |         wxGetApp().obj_manipul()->update_settings_value(m_selection); | ||||||
| 
 | 
 | ||||||
|         m_dirty = true; |         m_dirty = true; | ||||||
|  |  | ||||||
|  | @ -384,6 +384,7 @@ public: | ||||||
|                 Vec3d scaling_factor; |                 Vec3d scaling_factor; | ||||||
|                 Transform3d rotation_matrix; |                 Transform3d rotation_matrix; | ||||||
|                 Transform3d scale_matrix; |                 Transform3d scale_matrix; | ||||||
|  |                 Transform3d no_position_matrix; | ||||||
| 
 | 
 | ||||||
|                 TransformCache(); |                 TransformCache(); | ||||||
|                 explicit TransformCache(const Geometry::Transformation& transform); |                 explicit TransformCache(const Geometry::Transformation& transform); | ||||||
|  | @ -414,12 +415,14 @@ public: | ||||||
|             const Vec3d& get_volume_scaling_factor() const { return m_volume.scaling_factor; } |             const Vec3d& get_volume_scaling_factor() const { return m_volume.scaling_factor; } | ||||||
|             const Transform3d& get_volume_rotation_matrix() const { return m_volume.rotation_matrix; } |             const Transform3d& get_volume_rotation_matrix() const { return m_volume.rotation_matrix; } | ||||||
|             const Transform3d& get_volume_scale_matrix() const { return m_volume.scale_matrix; } |             const Transform3d& get_volume_scale_matrix() const { return m_volume.scale_matrix; } | ||||||
|  |             const Transform3d& get_volume_no_position_matrix() const { return m_volume.no_position_matrix; } | ||||||
| 
 | 
 | ||||||
|             const Vec3d& get_instance_position() const { return m_instance.position; } |             const Vec3d& get_instance_position() const { return m_instance.position; } | ||||||
|             const Vec3d& get_instance_rotation() const { return m_instance.rotation; } |             const Vec3d& get_instance_rotation() const { return m_instance.rotation; } | ||||||
|             const Vec3d& get_instance_scaling_factor() const { return m_instance.scaling_factor; } |             const Vec3d& get_instance_scaling_factor() const { return m_instance.scaling_factor; } | ||||||
|             const Transform3d& get_instance_rotation_matrix() const { return m_instance.rotation_matrix; } |             const Transform3d& get_instance_rotation_matrix() const { return m_instance.rotation_matrix; } | ||||||
|             const Transform3d& get_instance_scale_matrix() const { return m_instance.scale_matrix; } |             const Transform3d& get_instance_scale_matrix() const { return m_instance.scale_matrix; } | ||||||
|  |             const Transform3d& get_instance_no_position_matrix() const { return m_instance.no_position_matrix; } | ||||||
| #else | #else | ||||||
|             const Vec3d& get_position() const { return m_position; } |             const Vec3d& get_position() const { return m_position; } | ||||||
|             const Vec3d& get_rotation() const { return m_rotation; } |             const Vec3d& get_rotation() const { return m_rotation; } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tamasmeszaros
						tamasmeszaros