Commit Graph

109 Commits

Author SHA1 Message Date
f4dea6d829 when an invalid subtype is passed to a property, a list of valid subtypes is now included in the exception message.
from bug report [#33018], this avoids common mistakes.
2012-10-30 12:45:42 +00:00
900fa1bfb9 rename subtype FILENAME --> FILE_NAME to match FILE_PATH, DIR_PATH 2012-10-30 12:36:54 +00:00
2821f822c5 * New string property subtype: PASSWORD
When this new subtypes is used, then string of property is hidden using
asterisks, e.g.: mysecretpassword -> ****************

This code was reviewed and modified by Brecht. Thanks very much:
 - https://codereview.appspot.com/6713044/

This new subtype of string property is intended mostly for Add-on developers
writing Add-on which communicates with some server (http, sql, ftp, verse,
etc.). When this server requires user authentication and user has to type
username and password, then current API didn't allow to type 'hidden' password,
e.g. when you want to demonstrate this script, then everybody can see this
security password. Some examples of Add-on which could use this new subtype:
 - On-line database of textures
 - Integration of render farm
 - Integration of Verse

Security Notes:
 - You can copy paste hiddent string of property from text input using (Ctrl-C, Ctrl-V),
but you can do this in other GUI toolkits too (this behavior it is widely used).
 - Text of string property is stored in plain text, but it is widely used in other
GUI toolkits (Qt, Gtk, etc.).

Simple examples:
 - https://dl.dropbox.com/u/369894/draw_op_passwd.py
 - https://dl.dropbox.com/u/369894/blender-password.png
2012-10-26 12:58:54 +00:00
2223ca1c20 Fix #32973: crash adding python property with update=None parameter passed. 2012-10-25 22:37:05 +00:00
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
79d8367974 add warning that RNA update callbacks dont have checks for infinite recursion. 2012-09-28 09:35:32 +00:00
719aedaf60 mask - draw both sides of the curve when filled option is disabled. 2012-08-07 13:37:16 +00:00
b218d90176 fix a crash when python is registering enum properties and the items argument is a generator (some sequence type besides a list/typle), in this case it could free the strings before blender duplicates them.
this fixes [#32192] Import Images as Planes script is broken
2012-08-07 10:03:14 +00:00
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
46f1671c07 missing from previous commit 2012-05-27 21:56:19 +00:00
032d83ecc4 style cleanup: defines with braces 2012-05-27 20:13:59 +00:00
dd7229aee0 Added 'LIBRARY_EDITABLE' flag to bpy.props.*
Rationale: custom props on linked objects are editable through ops and the console but the UI code calls RNA_property_editable() which returns false if (id->lib && !(prop->flag & PROP_LIB_EXCEPTION))

Setting the 'LIBRARY_EDITABLE' flag allows UI templates to change these props (but the changes aren't saved!) for things like indices into CollectionProperties which live on the linked object
2012-05-19 21:22:01 +00:00
133bdac1d0 Patch [#31279] clarifiy a python error-string (when incorrectly specifying enum
items from python)

Thanks Philipp Oeser (lichtwerk)
2012-05-04 14:34:10 +00:00
abf551b1a5 style cleanup: py api 2012-03-26 20:41:54 +00:00
4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
70d3d1aca6 style cleanup: py/capi 2012-03-16 21:39:56 +00:00
9d49fa0e63 style cleanup - spelling corrections & update some incorrect comments. 2012-03-03 11:45:08 +00:00
c5d7f8e416 formatting edits (<120 line length), remove invalid 'defaults' keyword arg from docs. 2012-01-21 10:27:24 +00:00
309f3f31e7 remove redundant trailing slashes 2012-01-12 06:11:08 +00:00
6d878810c6 for bpy.props, when 'name' argument is not initialized, vallback to the attribute name rather than an empty string. 2011-12-28 04:25:46 +00:00
e17fd46c71 formatting edits only to use more consisted style 2011-12-26 12:26:11 +00:00
9c9099a805 formatting edits in py api, no functional changes 2011-12-18 08:50:06 +00:00
6ec3313e2d Fix: defining properties would fail with argument update=None instead of not
specifying the argument.
2011-11-29 22:57:35 +00:00
d52a811052 minor bpy api edits
- strict check for rna properties
- formatting edits (120 line width)
- use PyDoc_STRVAR macros for getset docstrings
2011-11-26 15:18:30 +00:00
d6c1009195 bytestring support for py/rna - this is so py can access data which
isn't meant to be accessed as unicode text.
2011-11-15 07:09:41 +00:00
0b1066af8e fix [#29251] Properties options={'SKIP_SAVE'} not working, patch attached
patch from Domino Marama (domino)
2011-11-14 15:05:41 +00:00
2b939904ab documentation - brief descriptions for bpy api files. 2011-11-05 08:21:12 +00:00
62f2218554 macro formatting & remve some unused code. 2011-11-05 05:44:52 +00:00
665f602f15 python string conversion
- use _PyUnicode_AsStringAndSize where possible
- use %R for PyErr_Format(...) rather then running repr on the object explicitly 
- use const char
2011-11-03 14:09:18 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
61389bba41 fix spelling mistakes in comments (and in some python error messages), nothing to effect translations. 2011-10-17 06:39:13 +00:00
276e5f7095 formatting edits & remove debug print. 2011-10-13 01:29:08 +00:00
c27926896f spaces -> tabs (whitespace only changes) 2011-10-06 22:04:01 +00:00
5e3110af05 add support for a 4th item for rna property enums in python so the numeric value can be passed, this is so you can animate the enum and keep the values even if you add items in the middle of the enum. - request from ZanQdo. 2011-09-28 09:18:20 +00:00
aaae90af33 fix [#28751] Item in Enum propertie is grayed out
was infact a very old bug where an empty title took the following word for the title, eg: "%t|First Item|Second Item"
the first item would be evaluated as a title.
2011-09-27 16:23:40 +00:00
943a026c60 py/rna string subtypes for strings which should be automatically translated:
layout.prop("blah", text="Translate Me!")
2011-09-21 13:53:35 +00:00
fa2ba5fbf5 - use static vars and functions where possible.
- use NULL rather than 0 when used as pointers.
2011-08-28 05:06:30 +00:00
de0db6c8da unit arg for FloatVectorProeprty 2011-08-02 10:56:09 +00:00
7cbc4c0dd7 IDProperty python module update
- add support for IDProp array slicing, but not resizing.
- rename array attribute type to typecode and use chars 'f', 'd', 'i' which match pythons array module. (was using int's which only have a meaning internally).
- rename function 'convert_to_pyobject' to 'to_dict' and 'to_list' for IDProp group and array types respectively.
- remove 'len' array attribute, calling len(array) is fine.
2011-06-17 05:45:46 +00:00
e44ae2c2a9 disable the readonly state while rna property callbacks run. 2011-06-07 16:08:49 +00:00
9c8cc9fe60 rna option not to save certain properties for redoing later, currently only used by operator presets. 2011-06-07 10:54:57 +00:00
617a08162f update ctest md5sums for import/export to match changes to the scripts, also some minor formatting change for bpy_props.c 2011-06-07 08:47:33 +00:00
8cee328546 Support for update callbacks in python defined RNA properties as discussed last meeting.
This means script authors can perform actions using these callbacks rather then on drawing which puts blender in a readonly state.

Simple example:

import bpy
def up_func(self, context):
    print("test")

bpy.types.Scene.testprop = bpy.props.FloatProperty(update=up_func)
bpy.context.scene.testprop = 11

# prints -> test
2011-06-06 17:50:20 +00:00
7ee9becfa3 disable python/string enum duplication from last commit because the array of duplicated strings can be freed and the pointers to the strings referenced still, the problem with python freeing strings that RNA references remains. 2011-06-03 04:39:18 +00:00
089d997cbc when making the C/RNA copy of the python enum, duplicate all strings since theres no guarantee python wont free them immediately after, though in practice this isn't so common. 2011-06-03 04:21:41 +00:00
5332c602c9 pre-allocate the array when converting py/rna enums, also fix for memory leak with bad values. 2011-06-03 03:19:22 +00:00
d46da5a09d mathutils support for color arithmetic, also some minor whitespace edits. 2011-06-02 08:29:16 +00:00
78d41d061b sphinx docstrng formatting (some lines were getting really long) 2011-05-26 19:13:01 +00:00
57c3c9e70f support for dynamic items in bpy.props.EnumProperty(), the items keyword argument can optionally be a function rather then a list. 2011-05-26 16:07:28 +00:00
15289c6048 use PyDoc_STRVAR macro, so its possible to build without docstrings. 2011-05-24 16:05:51 +00:00