Multiplying now also gives a message if it could not find a suitable spot for some objects

This commit is contained in:
Jaime van Kessel 2017-04-07 16:40:39 +02:00
parent f9fbd8c02e
commit e26ade0e6f
3 changed files with 19 additions and 6 deletions

View file

@ -49,10 +49,17 @@ class MultiplyObjectsJob(Job):
arranger = Arrange.create(scene_root=root)
offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(current_node, min_offset=self._min_offset)
nodes = []
found_solution_for_all = True
for i in range(self._count):
# We do place the nodes one by one, as we want to yield in between.
nodes.append(arranger.findNodePlacement(current_node, offset_shape_arr, hull_shape_arr))
node, solution_found = arranger.findNodePlacement(current_node, offset_shape_arr, hull_shape_arr)
if not solution_found:
found_solution_for_all = False
new_location = node.getPosition()
new_location = new_location.set(z = 100 - i * 20)
node.setPosition(new_location)
nodes.append(node)
Job.yieldThread()
status_message.setProgress((i + 1) / self._count * 100)
@ -61,4 +68,8 @@ class MultiplyObjectsJob(Job):
for new_node in nodes:
op.addOperation(AddSceneNodeOperation(new_node, current_node.getParent()))
op.push()
status_message.hide()
status_message.hide()
if not found_solution_for_all:
no_full_solution_message = Message(i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects"))
no_full_solution_message.show()