[Bf-committers] re: Python and layers
Matt Ebb
matt at mke3.net
Mon Oct 9 16:03:56 CEST 2006
Funny you guys mention this, I ran into a similar problem earlier
with the 3DS importer choking when I had all layers enabled. I was
going to mention it but I was without internet at the time and forgot.
Anyway, at least in my case I think the 'problem' (or at least the
possible solution) is in Blender itself. As you guys would know, the
layers int in blender is abused for more than just layers, which
complicates things.
However, when you press ~ to enable all 3D View layers, it actually
does more than that, it sets every bit in the layers int to 1. This
is bad behaviour, since when a user is pressing ~ they mean to show
all the 20 3D View layers, they don't mean to mess with the other 12
flags for local view or whatever it is. When python checks to see if
all layers are enabled, it's just looking at the 20 layer bits as it
should, and not the extra ones. So python was comparing the int that
should be when 20 layers are set to the number that is actually there
after you press ~ in Blender (which is much higher) and found that
they mismatch, giving an error. From memory, manually clicking all
the little layer buttons to set them on worked, which confirms this
theory.
Anyway, hope this info is useful to the current situ, and sorry for
not reporting earlier!
cheers
Matt
On 09/10/2006, at 23:43 PM, Campbell Barton wrote:
> Alexander Ewering wrote:
>>
>> On Mon, 9 Oct 2006, Campbell Barton wrote:
>>
>>> campbellbarton (Campbell Barton) 2006/10/09 06:29:24 CEST
>>>
>>> Modified files:
>>> blender/release/scripts image_billboard.py
>>> blender/release/scripts/bpymodules BPyRender.py
>>> blender/source/blender/python/api2_2x Scene.c
>>>
>>> Log:
>>> BPyRender.imageFromObjectsOrtho's now sets all layers visible,
>>> an error in Scene.c - scn.Layers disallowd all layer bits to be
>>> set.
>>
>> The error is not in Scene.c, but in BPyRender.py, which tries to
>> enable 21
>> layers instead of 20.
>>
>> To avoid such confusion, I would suggest replacing arbitary *decimal*
>> numbers which don't mean a thing with things such as (1 << 20)-1, or
>> at least 0xfffff.
>>
> are you sure? - if you enable all layers and then print them the
> scn.Layers the number it spits out is 2097151
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
------------------------------------------
Matt Ebb . matt at mke3.net . http://mke3.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.blender.org/pipermail/bf-committers/attachments/20061010/314aa413/attachment.htm
More information about the Bf-committers
mailing list