[Bf-python] Image.getMode

Gilbert, Joseph jgilbert at tigr.org
Thu Apr 21 17:39:32 CEST 2005


Yes use "h" if it's a 'short' "i" if it's a int (although I don't think
python really knows the difference). 
I do think that parsing data directly into datastructs is bad form
though. (guilty as charged :/) Invalid input should always be checked
before setting any value.  Image.setMode(8797843165) would not produce a
good result.

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Gergely
Erdelyi
Sent: Wednesday, April 20, 2005 11:56 AM
To: cbarton at metavr.com; Blender Foundation Python list
Subject: Re: [Bf-python] Image.getMode

Hello,

On 4/20/05, Campbell Barton <cbarton at metavr.com> wrote:
> I wanted to add image.flag to accsess image reflection options etc.
> This code dosent work, no idea why.

>     if( !PyArg_ParseTuple( args, "O", &arg ) )

If type of the value you are looking for is integer you could parse it
straight into an int type:

short flag;
if( !PyArg_ParseTuple( args, "h", &(self->image->flag) ) )

or even

if( !PyArg_ParseTuple( args, "h", &( flag ) ) )

If the flag is unsigned you can use "H" as format string.


Gergo
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list