[Bf-python] Re: Mesh modes
Campbell Barton
cbarton at metavr.com
Tue Jan 31 05:59:32 CET 2006
Ken Hughes wrote:
> Ken Hughes wrote:
>> Campbell Barton wrote:
>>
>>> Ken some problems setting mesh mode- have had the same problem
>>> http://www.elysiun.com/forum/viewtopic.php?t=58639 -
>>>
>>> I have the same problem on a simple mesh with 2.4.1
>>>
>>> mesh.mode = tempMe.mode
>>> ValueError: invalid bit(s) set in mask
>>>
>>> According to DNA_mesh_types.h
>>> ME_TWOSIDED = 4
>>> ME_AUTOSMOOTH = 32
>>> ME_NOPUNOFLIP = 2
>>>
>>> What is currently in the tempMe.mode is off by one. I set each mode
>>> one by one in the ui and did the export with a print of the
>>> tmpMe.mode to see them.
>>>
>>> If you change the code mesh.mode = tempMe.mode to mesh.mode =
>>> tempMe.mode - 1 it works.
>>>
>>> Any ideas on why it's off by one?
>>
>>
>> It's not off by one, it's off by a ton. There are many other bits
>> missing:
>>
>> /* me->flag */
>> #define ME_ISDONE 1
>> #define ME_NOPUNOFLIP 2
>> #define ME_TWOSIDED 4
>> #define ME_UVEFFECT 8
>> #define ME_VCOLEFFECT 16
>> #define ME_AUTOSMOOTH 32
>> #define ME_SMESH 64
>> #define ME_SUBSURF 128
>> #define ME_OPT_EDGES 256
>>
>> so the range-checking code in Mesh is complaining because it's not
>> looking for all of them.
>
> Actually, the fix for this is either to (a) add more values in the
> range-checking for the mesh.mode setter or (b) not do any checking.
> Seeing as how this is a bitmask, I'm favoring right now not doign any
> checking since this interface will change in the API refactor.
>
> Which brings up the question, what was the decision for handling
> bitmasks in the new API? Neither of the wiki pages on the refactor
> seem to lists any decision. Have none been made?
>
> Ken
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
Ken, not checking should be good :) IMHO (Faces too - causes similar
errors to mesh)
I have heard that flags will not be used.. just boolean properties....
However flags can be very usefull esp when storing data for later use so
Id say support both..
eg...
faceModes = [f.mode for f in me.faces]
... This cant be done efficiently if you have to access 8 or so seperate
boolean properties not to mention either storing a tuple or bools or
re-creating the flag.
- Cam
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-python
mailing list