Commit Graph

8 Commits

Author SHA1 Message Date
Campbell Barton
cc100eadc5 Operator cheat sheet (from the help menu)
writes all operators (including PyOperators) and their default values into a textblock.
Useful for an overview and checking consistancy.

eg. http://www.pasteall.org/7918/python

added rna functions text.clear() and text.write(str)
2009-09-16 06:02:56 +00:00
Campbell Barton
02f951c3a0 allow execution mode to be given as an argument to operators from python (requested by algorith)
example. bpy.ops.tfm.rotate('INVOKE_REGION_WIN', pivot=(0,1,2), ......)

bpy_array.c - was too strict with types, 0 should be allowed as well as 0.0 in a float array.
2009-09-03 22:37:09 +00:00
Campbell Barton
b2a77852ff user interface units, off by default.
- currently only distances work.
- user preferences, edit section to set the units and scale.
- option to display pairs (nicer for imperial display?)
- support for evaluating multiple comma separated values eg: 2',11" ..or.. 5ft, 4mil
- comma separated expressions/values accumulate 1+1,2**3,4cm/3
- attempted fast conversion from a value to a string so button drawing isn't too slow.

* imperial long/short *
- mile, mi
- yard, yd
- foot, '
- inch, "
- thou, mil

* metric long/short *
kilometer, km
meter, m
centimeter, cm
millimeter, mm
micrometer, um
nanometer, nm
picometer, pm
2009-08-11 18:53:01 +00:00
Campbell Barton
6c951fbb98 adding back button evaluation so you can do 1/60, 90*0.1 etc as well as dimension conversion 1km-10cm+4ft
Note...
- Python3.1 you don't need to add the .0 for divisions anymore (was esp annoying for button eval)
- Simple dimension input, imperial mi/yd/ft/in, metric km/m/cm/mm,  Later could display these values and have a pref for scene scale, atm it assumes 1BU == 1m.
2009-08-10 11:58:53 +00:00
Campbell Barton
4741137fc9 misc py/rna changes
- running a script from a file now uses the PyRun_File(FILE *, ...) rather then PyRun_String("exec(open(r'/somepath.py').read())"...), aparently FILE struct on windows could not ensured to be the same between blender and python, since we use our own python on windows now it should be ok.

- generating docs works again (operator update for py style syntax broke them)

- python operator doc strings was being overwritten

- added rna property attribute "default" to get the default value of a property, not working on arrays currently because variable length arrays are not supported.
2009-07-26 18:18:14 +00:00
Campbell Barton
b96a6e1838 issues auto generating rna docs
- add a warning when an operator name is NULL, set it to a dummy name to prevent crash. POSE_OT_constraints_clear had its name commented (not sure why)
- rna_Object_parent_type_itemf wasnt checking for context being NULL, needed for docs else it crashes.
- bpy.ops.add/remove didnt show up in a dir(bpy.ops)
2009-07-19 14:57:20 +00:00
Campbell Barton
d9a7e5144f Python operators
- simplified C operator API bpy.__ops__ since its wrapped by python now.
- needs the class to have an __idname__ rather then __name__ (like menus, headers)
- convert python names "console.exec" into blender names "CONSOLE_OT_exec" when registering (store the blender name as class.__idname_bl__, users scripters wont notice)
- bpy.props.props ???, removed
2009-07-19 13:32:02 +00:00
Campbell Barton
a705f64245 python access to operators now hides the _OT_ syntax, eg. SOME_OT_operator -> some.operator
this works for the calling operators from python and using the RNA api.

bpy.ops.CONSOLE_exec() is now bpy.ops.console.exec()

eg.
split.itemO("PARTICLE_OT_editable_set", text="Free Edit") becomes... split.itemO("particle.editable_set", text="Free Edit")

For now any operator thats called checks if its missing _OT_ and assumes its python syntax and converts it before doing the lookup.

bpy.ops is a python class in release/ui/bpy_ops.py which does the fake submodules and conversion, the C operator api is at bpy.__ops__

personally Id still rather rename C id-names not to contain the _OT_ text which would avoid the conversion, its called a lot since the UI has to convert the operators.
2009-07-17 12:26:40 +00:00