[Bf-python] Mesh select face discrepancy
Ken Hughes
khughes at pacific.edu
Wed Nov 9 20:22:37 CET 2005
*warning*: this e-mail was composed in real-time as I tried to figure
out what was happening, so I hope it doesn't contains inconsistencies :-)
--------------------------
Cam discovered something interesting yesterday than needs to be
addressed somehow:
He was working with a script which used Window.EditMode() to go in and
out of edit mode while selecting some faces. This worked if the 3d
window was in Object Mode, but not in UV Face mode. I looked at the
Mesh and NMesh modules but didn't see anything (and if I'm missing
something, please straighten me out). I did discover that if UV faces
are present (mesh.faceUV = true or mesh.hasFaceUV() = true) then the
texture face select setting have to be used instead. But again, this
only works when the non-EditMode setting is not Object Mode. The only
solution I can see which works in any case is to set/clear both selects.
I was thinking maybe just have one select setting in the API, and have
it give priority to UF Faces when they exists (and "write-through" to
both select bits on set/clear), but then I found this "discrepancy":
(a) select face in edit mode, then run script which does
Window.EditMode(0) and print faces with (1) face.sel=1 and (2) with
face.flag.SELECT=1. The script outputs the same faces
(b) select face in UV face mode, then run script which does
Window.EditMode(0) <which does nothing> and print faces with (1)
face.sel=1 and (2) with face.flag.SELECT=1. The script output different
faces
If I put a Window.EditMode(1) at the end of the script:
(a) is unchanged
(b) gives different faces on the first run but identical faces
thereafter; entering edit mode appears to "sync" the face select
settings by assigning the UV face settings to the mesh faces
So it appears (to me) that UV Face select has priority; (b) in both
cases above are artifacts of the API having access to mesh data in
different contexts (I think that's how Toni put it).
My proposal is: we only have one "select" setting for faces in the BPy
Mesh API instead of the two I ported from NMesh. Reading the face.sel
attribute would return what is set for tfaces (if defined), otherwise
what is set for mfaces. Setting the attribute would set both mfaces and
tfaces (if exists).
I haven't looked at the other bits in face.flags to see if there should
be a similar treatment, but I'll look while waiting for input on this.
Ken
More information about the Bf-python
mailing list