[Bf-python] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11293] branches/pyapi_devel/source/ blender/python/api2_2x: * Added Constants to Mesh

Campbell Barton cbarton at metavr.com
Tue Jul 17 00:50:45 CEST 2007


Ken Hughes wrote:
> Campbell Barton wrote:
>> Revision: 11293
>>           http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11293
>> Author:   campbellbarton
>> Date:     2007-07-16 23:20:52 +0200 (Mon, 16 Jul 2007)
>>
>> Log Message:
>> -----------
>> * added utility functions for new constants Const_FromPyObject to make getting the const from a PyObject easier.
>>  (also changed a few things you may want to look Ken)
>>   
> May want to discuss this further before we make a lot of changes.  One 
> thing which came up during the discussion
> about constants was being able to use strings instead of actual constant 
> objects:
> 
> ob.drawType = "BOUNDBOX"
> 
> Turns out this was not hard to implement so I wrote an API function 
> PyConst_Lookup() which searched for a match and
> returned the constant's value.  But since we didn't actually agree to 
> support this in the API, maybe we should decide whether
> we want this or not.  Again, from a coding standpoint it's not a big 
> issue, it's just a "standards issue".
> 
> Ken
> 
> (PS: description of implementation:
> http://wiki.blender.org/index.php/BlenderDev/Bitfields#Use_of_Strings_in_Place_of_Constants 
> )
As long as all blenders functions use Const_FromPyObject - we can 
keep/remove string support without touching every file that uses constants.

I dont have a strong opinion on weather to keep this or not.

Its nice how you can set a constant without all the prefix's of constants

but bad how there is 2 ways to set a constant and the string isnt 
associated with anything also a teeny bit bad how it does a lookup on 
the constant tho if you compare with all the lookups going on in pythons 
internals its no big deal.

- Cam



More information about the Bf-python mailing list