Commit Graph

1233 Commits

Author SHA1 Message Date
Campbell Barton
be4ceb5fdf Select interior faces, access from the mesh select menu
new mesh functions, remove duplicates in uvproject and mesh_skin
- face.edge_keys()
- edge.key()
- mesh.edge_face_count()
- mesh.edge_face_count_dict()
2009-11-05 12:37:49 +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
65f92c893e - remove UV mapping operator, call a header menu directly (so python can add items there)
- forgot to move bpy_sys.py last commit
2009-11-03 18:20:03 +00:00
Campbell Barton
6680dcd24a renamed bpy.sys to bpy.utils, since it used to be a attempt to replace pythons sys which is bundled now 2009-11-03 18:08:25 +00:00
Campbell Barton
da1765765b many operators uses Bases, for the python to set operators context python too needs to be able to access bases.
- added scene.bases (like scene.objects)
- renamed group create operator.

Example
 scene = bpy.data.scenes[0]
 C = {}
 C["scene"] = scene
 C["selected_editable_bases"] = [scene.bases[2], scene.bases[3]]
 
 bpy.ops.group.create(C)


Also made operator fake modules not return __call__ (reported by Stani, fixes autocomp. bug)
2009-11-02 11:14:22 +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
d964808846 made scripts pass the pep8 test (though not fully pep8 yet)
added comment in header to know if a script has been converted or not.
2009-10-31 23:35:56 +00:00
Campbell Barton
41c0236aaa GPL2 header from firebird (without disclaimer), notice theres no copyright attributed and only the GPLv2 (without the v2 or later clause).
Contributors list isnt used much in our C code so probably its easier if people just use svn blame for this.

Can change if this isnt acceptable but I guessed people didnt care so much since most scripts had no header.
2009-10-31 20:16:59 +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
9efc427f80 pep8 compliance for bpy_ops.py
add bpy.props to the modules so you can do...
 from bpy.props import *
2009-10-31 01:23:49 +00:00
Campbell Barton
ae9eae222c Patch from Stani for autocomplete
adds ability to complete in these situations
 bpy -> bpy.
 bpy.data.objects -> bpy.data.objects["Mesh"]

my autocomplete could only do bpy -> bpy.
2009-10-30 09:34:57 +00:00
Campbell Barton
4b3fd4a8e0 replacement for my own autocomplete module by stani
--- from his patch
All the functionality is in the console
folder:
- intellisense.py: the central module which loads others on demand
- complete_namespace: more or less a replacement for the old autocomplete.py
- complete_import: module completion (I find this very handy, not just luxury)

These complete_* modules work very simple and should also work outside blender. You give some  input and it returns a list with possible completions.

autocomplete.py is now deprecated.
2009-10-29 20:55:45 +00:00
Campbell Barton
c508e6198a Python can now run operators with their own context (data context).
The aim of this is to avoid having to set the selection each time before running an operator from python.

At the moment this is set as a python dictionary with string keys and rna values... eg.

C = {}
C["active_object"] = bpy.data.objects['SomeOb']
bpy.ops.object.game_property_new(C)

# ofcourse this works too..
bpy.ops.object.game_property_new({"active_object":ob})

# or...
C = {"main":bpy.data, "scene":bpy.data.scenes[0], "active_object":bpy.data.objects['SomeOb'], "selected_editable_objects":list(bpy.data.objects)}
bpy.ops.object.location_apply(C)
2009-10-29 09:25:11 +00:00
Campbell Barton
2138afc087 editing operator descriptions now works. 2009-10-28 11:55:58 +00:00
Campbell Barton
e024b46eb6 - 'id_data' attribute for py rna api, so you can get the Mesh from a face, Armature from a bone, etc.
- fixed crash when adjusting added objects settngs from the toolbar.
2009-10-28 11:31:24 +00:00
Campbell Barton
8510723cf4 patch from mindrones, uploads user edited docs to http://www.mindrones.com/blender/svn/
(rmb, edit docs)
2009-10-28 10:04:09 +00:00
Campbell Barton
64455004e0 ob.getChilren() often requested for 2.4x api, notice this is only 1 line of python. 2009-10-28 09:39:16 +00:00
Campbell Barton
29cae6de75 viewing docs for nested classes would fail, expects bpy.types.Scene.SceneGameData-class.html rather then bpy.types.SceneGameData-class.html 2009-10-28 09:03:08 +00:00
Campbell Barton
4e7768066e patch from Stani to prevent hasattr(bpy.ops, '__call__') being True 2009-10-27 15:25:27 +00:00
Campbell Barton
1c1659eb28 - Right click menu can open links directly to API reference docs (rna and operators)
- Generated and uploaded api docs - http://www.blender.org/documentation/250PythonDoc
- Added Edit docs menu item & operators as discussed with Mindrones, Brecht, Stani & Letterip @ bconf, needs some web backend. python operator can aparently use xml/rpc to upload docstrings.
- Added operator invoke function - context.manager.invoke_props_popup(self.__operator__, event)
  this calls a popup for invoke by default (which intern calls execute())

- Own recent commit to game framing applied to non-camera views too.
- v3d->persp is deprecated but still used in some places.

- Transforming strips could overlap 1 frame if moving them below frame 0
- Transforming overlapping strips could go into an eternal loop (though overlapping strips should not exist)
2009-10-27 02:54:25 +00:00
Campbell Barton
b06640c583 changed WM_OT_context_* operators to pass through if one of the members in the path is None, rather then raising an error.
This means if you refer to a member of an object it will fail silently if there is no active object, but if you use an invalid attribute of the object it raises an error.
The method to check this is not nice but works well enough.

also removed pageup/down keys for changing the active shape since listviews can do this now.
2009-10-22 16:21:06 +00:00
Campbell Barton
3a6da12ab1 added new context operator WM_OT_context_cycle_int, use for switching between active shape keys 2009-10-21 10:11:03 +00:00
Campbell Barton
f4d6bbd656 - improvements from Mathias Panzenböck (panzi) patch [#19695], which avoid conversion to/from strings with context property assignment. though didnt apply entire patch.
- [#19698] Add Menu Item: View3d -> Object -> Move to layer
  from Howard Brooks (hbroo)
- had cursor grab commented by mistake for X11
2009-10-21 07:56:08 +00:00
Campbell Barton
7bed5e35b4 added operators for setting rna for each type, this avoids having double "'quoted'" strings from C which is ugly. 2009-10-14 20:09:21 +00:00
Campbell Barton
4ef0ef1927 added mesh mirror flag, now store this per mesh
button in mesh interface
also dont register operators that change context
2009-10-14 14:28:05 +00:00
Campbell Barton
e3d8c8eba8 added back space switching keys Shift+F2 to F12
- Shift+F2 was Export DXF, made Logic Editor
- Shift+F4 was data browser, made console
- Shift+F11 was fullscreen in 2.5, changed fullscreen to Alt+F11

added Area.type so RNA can switch the type.
2009-10-13 17:50:14 +00:00
Campbell Barton
edfe78aec9 Context operators for adjusting context values directly to avoid adding operators for adjusting single values which also need duplicate notifiers.
wm.context_set(path="scene.tool_settings.someattr", somevalue)
wm.context_toggle(path="scene.tool_settings.somebool")
wm.context_toggle_values(path="scene.tool_settings.some_enum", value_1="somevalue", value_2="othervalue") # switch between 2 values
wm.context_cycle_enum(path="scene.tool_settings.some_enum", reverse=False)

the path value is taken from the context so the full path is 
context.scene.tool_settings...

This means in keymaps you can cycle draw modes, change PET- anything with rna access.
If its not so nice to map keys to operators like wm.context_set we could use macro's to wrap it and have its own name

Use this for PET and setting pivot options

- Made userpref key shortcut Ctrl+Alt+U since its not used in 2.4x
- added pivot_point_align (Alt+Comma)
- added PET wasnt rna wrapped correctly.
2009-10-13 15:30:19 +00:00
Campbell Barton
a3f6b0ed00 - add torus back from 2.4x as an operator
bpy.ops.mesh.primitive_torus_add(major_radius=1, minor_radius=0.25, major_segments=48, minor_segments=16)

- experemental dynamic menus, used for INFO_MT_file, INFO_MT_file_import, INFO_MT_file_export and INFO_MT_mesh_add. these can have items added from python.
eg.

- removed OBJECT_OT_mesh_add, use the python add menu instead.

- made mesh primitive ops -  MESH_OT_primitive_plane_add, ...cube_add, etc. work in object mode.

- RNA scene.active_object wrapped

- bugfix [#19466] 2.5: Tweak menu only available for mesh objects added within Edit Mode
  ED_object_exit_editmode was always doing an undo push, made this optional using the existing flag - EM_DO_UNDO, called everywhere except when adding primitives.
2009-10-10 21:23:20 +00:00
Campbell Barton
a0d8d7afe0 edge loop delete, should be a c macro but they cant do settings atm 2009-10-05 19:42:48 +00:00
Campbell Barton
dab61acd45 Added "scripts/modules" as permanent module search path.
- added bpy.sys as a python module - with bpy.sys.expandpath()
- moved bpy.ops into scripts/modules
- moved autocomplete into its own module from space_console.py
2009-09-28 04:29:01 +00:00