PyMeshLab
PyMeshLab copied to clipboard
BUG in ms.current_mesh().selected_face_number() ???
Hi: I am playing a bit with using face quality identifiers to extract selected faces. Below is a simplified script of the unexpected behavior:
ms = pymeshlab.MeshSet() ms.create_sphere() ms.compute_scalar_by_function_per_face(q="1") print(" TOTAL SELECTED FACES ", ms.current_mesh().selected_face_number()) assert 0 == ms.current_mesh().selected_face_number() ms.compute_selection_by_scalar_per_face(minq=-2, maxq=-2) print(" TOTAL SELECTED FACES WITH QUALITY 1 --> ", ms.current_mesh().selected_face_number()) ms.compute_selection_by_scalar_per_face(minq=0.1, maxq=0.2) print(" TOTAL SELECTED FACES WITH QUALITY 1 --> ", ms.current_mesh().selected_face_number()) aux = ms.current_mesh().face_selection_array() print(" Total faces ", len(aux), "vs. selected faces ", len([f for f in aux if f]))
If you run this, you get:
TOTAL SELECTED FACES 0 TOTAL SELECTED FACES WITH QUALITY 1 --> 1280 TOTAL SELECTED FACES WITH QUALITY 1 --> 1280 Total faces 1280 vs. selected faces 1280
It seems that once you have set the function ms.compute_scalar_by_function_per_face(q="1"), the array ms.current_mesh().face_selection_array() sets all values to True
Is this a bug or am I using it wrong ?
Cheers