Commit Graph

29 Commits

Author SHA1 Message Date
Campbell Barton
7c0d2ffb64 pep8 cleanup 2010-03-06 01:40:29 +00:00
Campbell Barton
ed7f4f2e3c make BGL and BLF modile names lowercase 2010-02-28 14:57:26 +00:00
Campbell Barton
3bbf1917c5 python BLF module for drawing text, updated template to draw text in the 3D view. 2010-02-28 11:18:54 +00:00
Campbell Barton
5369bd9c21 - template with an example of a modal operator drawing with opengl (draw a line on the screen)
- access to event.mouse_region_x/y
- basic type checking to callback functions (use PyCapsule names)
2010-02-28 09:36:02 +00:00
Campbell Barton
a9307a4dd3 [#21295] Escape key doesn't cancel python modal operators
also fix distance with lamps being negative for typed in values.
2010-02-24 15:56:27 +00:00
Campbell Barton
97bdfe6f1b pep8 cleanup + correction for external player operator return value. 2010-02-22 23:32:58 +00:00
Campbell Barton
d85191bd2d modal operator python template 2010-02-21 16:20:32 +00:00
Campbell Barton
95069f2909 pep8 changes 2010-01-31 14:46:28 +00:00
Campbell Barton
0a0f4c9d81 Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
- Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
2010-01-25 09:44:04 +00:00
Campbell Barton
9d96399eeb - panel python template
- nicer syntax to capitalize words
2010-01-23 18:51:56 +00:00
Campbell Barton
5272991e8b generic operator menu was searching for "type" and using the first enum property if it wasnt found.
this is too arbitrary and could break if roperty order is changed.
store the property in the operator type that is to be used for menu and enum search func's.

python function for searching operator enums on invoke. (just need dynamic python enums now)
 wm.invoke_search_popup(self)
2010-01-15 22:40:33 +00:00
Campbell Barton
b0f87935a8 spelling errors, no real changes to code. 2010-01-14 10:59:42 +00:00
Campbell Barton
9de67b8ca9 UV operator template 2010-01-14 10:50:58 +00:00
Campbell Barton
5afd084513 replace dynamic_menu.py with Menu classmethods much less complicated.
access append/prepend eg.

bpy.types.INFO_MT_file_import.append(lambda self, context: self.layout.operator("import_some.format"))
2009-12-25 22:16:19 +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
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
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
da2db4bc58 patch from Ronan Bignaux
use python3 print()
2009-11-21 17:41:09 +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
273a7ab9c5 remove GPL headers from templates, am happy for them to be public domain 2009-11-18 14:25:36 +00:00
Campbell Barton
4e61f8a836 pep8 whitespace commit
bpy/rna api (no functionality change, just move getting the srna py base into a function)
2009-11-07 22:07:46 +00:00
Campbell Barton
3fa8959bb5 - move WM operators out of bpy_ops.py into their own file
- fix operator template
2009-11-04 20:21:08 +00:00
Campbell Barton
dd130350d5 make python operator instances subclasses of the wmOperator when called.
was subclassing the operator's type before.

Removes the need for passing self.__operator__, can pass self directly.
2009-11-02 08:32:00 +00:00
Martin Poirier
9ea292290b Correct GPL license header for all python scripts 2009-11-01 15:21:20 +00:00
Campbell Barton
f9b19d54b5 tabs to spaces, remove trailing white space. (apart of pep8)
didnt do "release/scripts/io" since some exporters cant be auto converted
2009-10-31 19:31:45 +00:00
Campbell Barton
e4881eef52 define operator properties in the class, similar to django fields
# Before
[
	bpy.props.StringProperty(attr="path", name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= ""),
	bpy.props.BoolProperty(attr="use_modifiers", name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default= True),
	bpy.props.BoolProperty(attr="use_normals", name="Export Normals", description="Export Normals for smooth and hard shaded faces", default= True),
	bpy.props.BoolProperty(attr="use_uvs", name="Export UVs", description="Exort the active UV layer", default= True),
	bpy.props.BoolProperty(attr="use_colors", name="Export Vertex Colors", description="Exort the active vertex color layer", default= True)
]

# After
path = StringProperty(attr="", name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= "")
use_modifiers = BoolProperty(attr="", name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default= True)
use_normals = BoolProperty(attr="", name="Export Normals", description="Export Normals for smooth and hard shaded faces", default= True)
use_uvs = BoolProperty(attr="", name="Export UVs", description="Exort the active UV layer", default= True)
use_colors = BoolProperty(attr="", name="Export Vertex Colors", description="Exort the active vertex color layer", default= True)
2009-10-31 16:40:14 +00:00
Campbell Barton
ea265fc697 change blender python interface for classes not to ise __idname__ rather bl_idname since __somename__ is for pythons internal use.
replacements...
"__idname__" -> "bl_idname"
"__props__" -> "bl_props"
"__label__" -> "bl_label"
"__register__" -> "bl_register"
"__undo__" -> "bl_undo"
"__space_type__" -> "bl_space_type"
"__default_closed__" -> "bl_default_closed"
"__region_type__" -> "bl_region_type"
"__context__" -> "bl_context"
"__show_header__" -> "bl_show_header"
"__URL__" -> "_url"
2009-10-31 13:31:23 +00:00
Campbell Barton
6f1e9a843e Script templates, including game logic scripts from 2.4x and new operator template.
Files copied into scripts/templates will automatically appear in the menu.

the operator template is a bit rough but a start.
2009-10-29 11:26:44 +00:00