Commit Graph

27 Commits

Author SHA1 Message Date
Campbell Barton
039d087171 subtype support for properties in bpy.props. 2010-02-01 22:04:33 +00:00
Campbell Barton
95069f2909 pep8 changes 2010-01-31 14:46:28 +00:00
Campbell Barton
b8ca67ca33 custom properties panels for most ID types. use subclassing to keep panel UI definitions minimal 2010-01-08 08:54:41 +00:00
Campbell Barton
be67970303 fix for [#20244] importing .obj without "Object" option checked crashes blender 2009-12-25 20:40:00 +00:00
Campbell Barton
5f4e24d599 operator draw function working again. needed to add layout to the operator to give access to "self.layout" - like panels, headers and manu's have 2009-12-24 21:17:14 +00:00
Campbell Barton
bbe13e7823 * register operators like other classes
* operators now return sets (converted into flags)
* can't remove bpy_operator_wrap.c since macro's still use the custom register funcs
2009-12-24 19:50:43 +00:00
Campbell Barton
a1656300ba script for automating pep8 checks.
On ubuntu/debian install these tools...

   sudo apt-get install pylint pyflakes python-setuptools python-pip
   sudo pip install pep8

then run from blenders source dir...
   python release/test/pep8.py

This searches for the comments "# <pep8 compliant>" and "# <pep8-80 compliant>", running the checking tools on these scripts only.

* some minor pep8 corrections too.
2009-12-13 13:59:16 +00:00
Campbell Barton
f26e188a7c - rigify context changes & example for delta
- sequencer transform had 0.0 for rotation minimum
- missed icon rename in last commit
2009-12-10 11:56:31 +00:00
Campbell Barton
f4fa39a551 white space commit (spaces -> tabs and clearing whitespace) 2009-12-08 07:11:43 +00:00
Campbell Barton
750764f411 rna flag PROP_ENUM_FLAG which makes rna props a tuple of enums when converted into a PyObject
only used by wm.invoke_props_popup() currently
2009-12-07 00:16:57 +00:00
Campbell Barton
5ebe54f470 pep8 edits and fix some warnings 2009-12-05 22:03:07 +00:00
Guillermo S. Romero
648122b1a2 String fix and a bunch of PEP8 issues I had collected in the meanwhile. 2009-12-04 17:54:48 +00:00
Campbell Barton
727d9bb059 rig-generation from metadata, the idea is to input a simple rig with metadata matching preset definitions
these are applied by adding constraints, drivers, control bones etc. making it possible to re-apply changes & improvements to many rigs at once.

testcase makes a finger rig (like in BBB) from 3 bones, the base tagged with an id property "type":"finger".

still missing is a way to update the driver dep's


also fixed an error  in the property UI when the active bone is not on the active layer.
2009-11-24 00:02:21 +00:00
Campbell Barton
e968017951 - new pyrna api functions srna & prop path_to_id(), useful when setting driver target paths.
This means you can have a pose bone for eg and get the path...
   pose.bones["Bone"]
 uses rna internal functions, so will work for sequence strips etc.

- StructRNA.get(), used for getting ID props without exceptions...
 val = C.object["someKey"]
 or..
 val = C.object.get("someKey", "defaultValue") # wont raise an error

- change rna property for testing if rna props are editable, test the flag rather then calling the function since the function depends on blenders state.

- fix a python exception with the ID-Property popup UI (when editing in more then 1 step)
2009-11-23 23:17:23 +00:00
Campbell Barton
e0fc6d0c33 more ui api changes.
- remove functions such as operator_int(), operator_enum(), operator_string
  this mixed with keyword arguments in a way that made them hard to read.
  Instead, have operator() always return properties rather then needing an argument.

- rename prop_pointer() --> prop_object(), pointer is more a C thing.

- missed item_enumR(), rename to prop_enum()
2009-11-23 11:43:38 +00:00
Campbell Barton
caab05ec8c rna UI api rename...
note: this aims to follow pep8 however I chose to use 'prop/props' rather then 'property/properties' because it would make function names too long.

itemR() --> prop()
items_enumR() --> props_enum()
item_menu_enumR() --> prop_menu_enum()
item_pointerR() --> prop_pointer()
itemO() --> operator()
item_enumO() --> operator_enum()
items_enumO() --> operator_enums()
item_menu_enumO() --> operator_menu_enum()
item_booleanO() --> operator_boolean()
item_intO() --> operator_int()
item_floatO() --> operator_float()
item_stringO() --> operator_string()
itemL() --> label()
itemM() --> menu()
itemS() --> separator()

batch script used http://www.pasteall.org/9345
2009-11-23 00:27:30 +00:00
Campbell Barton
1dfbf3a9f6 - aspectx wasnt saved in the render preset
- define a preset base class
- cleanup some comments and whitespace
2009-11-21 23:55:14 +00:00
Campbell Barton
34e7eb1676 use a metaclass to have operator attributes register and display in the order defined. 2009-11-20 20:58:46 +00:00
Campbell Barton
512c06afdb - StructRNA's __dir__ was missing members from its classes __dict__
- property editor can now set button min/max values and edit the tooltip
- custom props tooltips were not displayed
- cleanup the property UI 
- remove hacks that were used for editing (edit is now a popup operator)
- object.children was broken
2009-11-19 18:22:21 +00:00
Campbell Barton
e61c90e416 operators were copying the properties from the rna operator into the class instance.
however this meant the invoke function could not modify properties for exec to use (unless it called exec directly after)
since the popup for eg would re-instance the python class each time.

now use the operator properties directly through rna without an automatic copy.

now an operator attribute is accessed like this...
self.path --> self.properties.path
2009-11-19 17:12:08 +00:00
Campbell Barton
ae5a814f26 ID properties that are displayed via RNA can now define their own UI settings,
only implimented min/max precision & step.

at the moment there is no way to edit these other then via python

example of setting UI limits...

>>> C.object['foo'] = 0.5
>>> C.object['_RNA_UI'] = {'foo': {'step': 0.5, 'soft_max': 10.0, 'soft_min': 0.0, 'precision': 2, 'description': 'Some setting'}}

Also fixed typo's: precission -> precision
2009-11-18 20:01:35 +00:00
Campbell Barton
318e9aa5d1 - rna attribute setting problem, class instances could not set their own attributes because they are blocked by our own internal setattr.
this could be supported again easily however it leads typo's & api changes not showing any errors.

  This broke povray export.
  Solution for now is to allow setting private properties starting with '_'

  eg, 
    ob = bpy.context.object
    
    ob._foo = [1,2,3] # this is a python list, it will stay only as long as this PyObject is active
    ob.foo = 1 # raises an error!, only for rna properties
    ob["foo"] = 1 # converts to an ID property and is saved

    using the underscore like this should really be used for classes internally.

- povray failed on armatures

- menu key wasn't using WM_keymap_add_menu
2009-11-18 08:40:18 +00:00
Campbell Barton
2ae15e39ad make animation system and rna internals use getattr style syntax for user defined properties
bone["foo"] rather then bone.foo
matches python and avoids naming collisions
2009-11-17 20:46:59 +00:00
Campbell Barton
64104524cc fix for error editing a string property with quotes 2009-11-17 13:18:26 +00:00
Campbell Barton
f7682e2e0f - in pose mode, pose bone properties are edited rather then armature bone
- new id property array method convert_to_pyobject()
- editing an array in the UI broke
- fixed for own error when updating ID prop api
2009-11-17 12:54:29 +00:00
Campbell Barton
cf26cdd508 nicer UI, allow editing of values without pressing edit for basic types 2009-11-17 10:30:54 +00:00
Campbell Barton
7636d17af6 property editor for bone and object ID props, add/remove/edit
good example of how editing NON rna data results in very weired scripts :/
2009-11-16 22:53:28 +00:00