Commit Graph

63 Commits

Author SHA1 Message Date
Campbell Barton
ddbfb05c84 rna context rename
* context.main & bpy.types.Main --> context.blend_data & bpy.types.BlendData
* context.manager --> context.window_manager
2010-09-02 04:53:05 +00:00
Campbell Barton
50bce31dbb rna api changes
- mesh.add_geometry(v, e, f)  --> mesh.vertices.add(tot), mesh.edges.add(tot), mesh.faces.add(tot)
- mesh.add_material(mat) --> mesh.materials.link(mat)

changed material.link so it always adds a material even if it exists in the list, this behavior is good for users but not scripts since it can mess up indicies (some formats may have the same material set twice).
2010-08-26 22:44:05 +00:00
Campbell Barton
f6c323aa42 - move more active properties into their collections:
scene.active_keying_set --> scene.keying_sets.active
  ...same for active_uv_texture. active_vertex_color, active_keyconfig, 

- move mesh.add_uv_layer() and mesh.add_vertex_color() into their collections
  also have them return the newly created layer and dont set the layer active.

  uvtex = mesh.uv_layers.new(name)
  vcol = mesh.vertex_colors.new(name)
2010-08-23 22:16:45 +00:00
Campbell Barton
9784a1169d rna naming: verts -> vertices 2010-08-18 03:42:26 +00:00
Campbell Barton
3bd039eff9 apply rna rename most of the show_*, names. 2010-08-17 17:03:52 +00:00
Campbell Barton
a6f13f9d7b poll() as a python '@staticmethod' was too limiting and didnt allow useful base class poll functions in many cases.
now rna functions that dont have a 'self' are automatically assumed '@classmethods'.

de-duplicated poll functions and made some minor tweaks too.
2010-08-09 01:37:09 +00:00
Campbell Barton
163f6055d2 bugfix [#23182] Using self.report() inside poll() gives crash
poll() function is now a static method in python, this is more correct, matching C where the operator is not created to run poll.


    def poll(self, context): ...

is now...

    @staticmethod
    def poll(context): ...

Pythons way of doing static methods is a bit odd but cant be helped :|

This does make subclassing poll functions with COMPAT_ENGINES break, so had to modify quite a few scripts for this.
2010-08-05 16:05:30 +00:00
Martin Poirier
5b345524ea RNA Types metaclass registration
See mailing list posts for details [1][2][3]

Addons still need to be fixed; Campbell said he'd do it today.

See any of the py files (outside netrender) in this commit for how to do it (it's rather simple).

[1] http://lists.blender.org/pipermail/bf-committers/2010-February/026328.html
[2] http://lists.blender.org/pipermail/bf-committers/2010-August/028311.html
[3] http://lists.blender.org/pipermail/bf-committers/2010-August/028321.html
2010-08-02 02:55:12 +00:00
Nathan Letwory
11b140fb3a patch [#23110] isolate render type UI labelling + operator to clear all hide render flags in scene by Peter Schulman 2010-07-30 23:25:26 +00:00
Campbell Barton
9a0e0027f8 fix for error in select hierarchy if no children exist. 2010-07-23 05:49:12 +00:00
Campbell Barton
02da5ecfed Apply first pass of edits to rna values from rna_booleans.txt.
These are not animated and are best not change names like this too late in the release.

ActionGroup.selected -> select:    boolean    Action Group is selected
BezierSplinePoint.hidden -> hide:    boolean    Visibility status
BezierSplinePoint.selected_control_point -> select_control_point:    boolean    Control point selection status
BezierSplinePoint.selected_handle1 -> select_left_handle:    boolean    Handle 1 selection status
BezierSplinePoint.selected_handle2 -> select_right_handle:    boolean    Handle 2 selection status
Bone.restrict_select -> hide_select:    boolean    Bone is able to be selected
Bone.selected -> select:    boolean
CurveMapPoint.selected -> select:    boolean    Selection state of the curve point
EditBone.restrict_select -> hide_select:    boolean    Bone is able to be selected
EditBone.selected -> select:    boolean
EditBone.selected_head -> select_head:    boolean
EditBone.selected_tail -> select_tail:    boolean
EditBone.locked -> lock:    boolean    Bone is not able to be transformed when in Edit Mode
EditBone.hidden -> hide:    boolean    Bone is not visible when in Edit Mode
NEGATE * FCurve.disabled -> enabled:    boolean    F-Curve could not be evaluated in past, so should be skipped when evaluating
FCurve.locked -> lock:    boolean    F-Curve's settings cannot be edited
FCurve.muted -> mute:    boolean    F-Curve is not evaluated
FCurve.selected -> select:    boolean    F-Curve is selected for editing
NEGATE * FCurve.visible -> hide:    boolean    F-Curve and its keyframes are shown in the Graph Editor graphs
FCurveSample.selected -> select:    boolean    Selection status
GPencilFrame.selected -> select:    boolean    Frame is selected for editing in the DopeSheet
GPencilLayer.locked -> lock:    boolean    Protect layer from further editing and/or frame changes
GPencilLayer.selected -> select:    boolean    Layer is selected for editing in the DopeSheet
Keyframe.selected -> select:    boolean    Control point selection status
Keyframe.selected_handle1 -> select_left_handle:    boolean    Handle 1 selection status
Keyframe.selected_handle2 -> select_right_handle:    boolean    Handle 2 selection status
MeshEdge.selected -> select:    boolean
MeshEdge.hidden -> hide:    boolean
MeshFace.hidden -> hide:    boolean
MeshFace.selected -> select:    boolean
MeshVertex.hidden -> hide:    boolean
MeshVertex.selected -> select:    boolean
MotionPathVert.selected -> select:    boolean    Path point is selected for editing
NlaStrip.selected -> select:    boolean    NLA Strip is selected
NlaTrack.locked -> lock:    boolean    NLA Track is locked
NlaTrack.muted -> mute:    boolean    NLA Track is not evaluated
NlaTrack.selected -> select:    boolean    NLA Track is selected
Object.restrict_render -> hide_render:    boolean    Restrict renderability
Object.restrict_select -> hide_select:    boolean    Restrict selection in the viewport
Object.restrict_view -> hide:    boolean    Restrict visibility in the viewport
Object.selected -> select:    boolean    Object selection state
ObjectBase.selected -> select:    boolean    Object base selection state
PoseBone.selected -> select:    boolean
Sequence.right_handle_selected -> select_right_handle:    boolean
Sequence.selected -> select:    boolean
SplinePoint.selected -> select_control_point:    boolean    Selection status
TimelineMarker.selected -> select:    boolean    Marker selection state
Sequence.left_handle_selected -> select_left_handle:    boolean
ActionGroup.locked -> lock:    boolean    Action Group is locked
Bone.hidden -> hide:    boolean    Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)
SplinePoint.hidden -> hide:    boolean    Visibility status
FModifier.muted -> mute:    boolean    F-Curve Modifier will not be evaluated

 note: rebaned uv_select to select_uv
2010-07-15 16:56:04 +00:00
Campbell Barton
80355fd456 bugfix [#22843] Cannot export to folder with ".blend" on the end. 2010-07-14 11:58:19 +00:00
Campbell Barton
a305a72939 select parent/child now works for multiple selections ([/] keys) 2010-07-14 09:40:26 +00:00
Campbell Barton
9a85435e96 rna api:
rename object.matrix --> matrix_world
added object.matrix_local (parent relative matrix)
2010-07-03 17:39:29 +00:00
Campbell Barton
1028284301 pep8, whitespace edits 2010-06-09 19:12:03 +00:00
Campbell Barton
4d6d68bfa1 obscure sounding feature thats actually useful: isolate render type
Select lamp, isolate, all other visible lamps are disabled.
2010-05-20 15:30:28 +00:00
Campbell Barton
873d4a3f05 py api
- mathutils.Color.hsv attribute. eg. material.diffuse_color.hsv = 0.2, 0.8, 0.4
- Vector/Euler/Quaternion/Color now only take a single seq arg.
- internal function for parsing arrays. (cleanup messy internal list/vector/tuple/seq parsing)
- didnt update rigify yet.
2010-04-25 19:27:59 +00:00
Campbell Barton
67cfc427ee PyAPI
- added new mathutils.Color() type, use with rna so we can do for eg:
 material.diffuse_color.r = 1.0
 # also has hsv access
 material.diffuse_color.s = 0.6

 - made Mathutils and Geometry module names lowercase.
2010-04-11 14:22:27 +00:00
Campbell Barton
7c0d2ffb64 pep8 cleanup 2010-03-06 01:40:29 +00:00
Campbell Barton
fbb8672da4 replace operator options bl_undo and bl_register with bl_options
eg.
 bl_options = {'REGISTER', 'UNDO', 'BLOCKING', 'GRAB_POINTER'}

This didnt exist when operators were originally wrapped.
2010-03-01 00:03:51 +00:00
Campbell Barton
0b33be5a7b select parent/child in object mode with [] keys, like pose mode.
also needed to extend the RNA api to allow C to set enums without meaningful values.
2010-02-25 15:41:46 +00:00
Campbell Barton
97bdfe6f1b pep8 cleanup + correction for external player operator return value. 2010-02-22 23:32:58 +00:00
Campbell Barton
bc3d96678d bugfix [#21233] Crash in pyapi, with new object.
pass the obdata as an argument rather then assigning later so as not to allow an invalid state.
2010-02-22 00:07:46 +00:00
Campbell Barton
576b0d9777 join as UVs referenced older api function name 2010-02-17 16:31:37 +00:00
Campbell Barton
23efeff6a9 [#21177] Text editor
Running scripts directly didnt call the register function, even though this is not essential its good to be able to run a script directly and see changes in the UI.
2010-02-16 09:55:07 +00:00
Campbell Barton
39c04315e2 change python scripts so modules which register with blender have a register() function rather then making import automatically run the register functions (generally considered bad practice by python people) 2010-02-14 11:21:21 +00:00
Campbell Barton
081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Daniel Salazar
bc5f81ee3c Clean up of tooltips in py operators and better operator name for
randomize transform
2010-02-11 23:13:47 +00:00
Campbell Barton
157a694607 - select active camera operator
- calling menu use exec rather then invoke
2010-02-11 21:17:05 +00:00
Campbell Barton
19b5cc3d16 make dupliface rotation was wrong. 2010-02-10 16:40:02 +00:00
Campbell Barton
358c956637 make dupliface operator (access from object menu)
scene.object.link() now returns the new ObjectBase
2010-02-10 16:10:47 +00:00
Campbell Barton
2973ffbb49 add menus for vertex group and shape key panels, functionality wasnt communicated well with icons and getting cluttered.
also made 'transfer shape' script copy into the active object to match 'join as shape', which was quite confusing before.
2010-02-05 14:29:05 +00:00
Campbell Barton
02dc4e9748 shape key transfer
- use the shape key basis for applying relative vertex locations
2010-02-02 12:04:03 +00:00
Campbell Barton
7bd3d1213a shape key transfer fix.
workaround for the vert locations not being relyable, use the base shape key rather then the verts to calculate the offsets.
2010-02-01 15:09:35 +00:00
Campbell Barton
95069f2909 pep8 changes 2010-01-31 14:46:28 +00:00
Campbell Barton
bffad18da8 [#20046] 2.5 "bridge faces" tool doesn't delete original selection
remove this script, its not good enough, remove grease pencil retopo also.
2010-01-26 14:39:01 +00:00
Matt Ebb
085795e356 Fix [#20514] In sculpting mode is possible to use page down/up to exceed the actual multiresolution level 2010-01-15 05:00:02 +00:00
Campbell Barton
231d29ccce Join as UVs.... (copies matching UVs to another object with the same topology)
nice that it uses foreach_get/set for fast array copying from python.

note: this is getting out of hand, we beed some central panel/interface for copying mesh data about - shapes, UVs weights etc. at the moment they are accessed from all different places.
2010-01-14 14:06:27 +00:00
Campbell Barton
08c9ecb3b0 RNA/Py API
change how data is added. eg.
 bpy.data.add_mesh(name) --> bpy.data.meshes.new(name)
 bpy.data.remove_lamp(lamp) --> bpy.data.lamps.remove(lamp)


image and texture stil use add_* funcs
2010-01-09 23:44:01 +00:00
Campbell Barton
e292b5badc fix for crash when setting a shapekeys name in rna, (probably other properties too).
When the shapekey was returned from the object it didnt use the data's ID which is expected elsewhere in RNA.

Transfer shape now also sets the name.
2010-01-06 12:19:46 +00:00
Campbell Barton
bb2c074822 missing check for shape key 2010-01-06 11:21:57 +00:00
Campbell Barton
8177f343a0 - object.add_shape_key(name="Key", from_mix=True)
- ensure new shape key names are unique
- Transfer ShapeKey now can have its settings changes (redo operator)
2009-12-28 18:03:04 +00:00
Campbell Barton
351f5d1837 - loading missing files didnt give any warning
- shape key transfer poll function
2009-12-27 23:29:34 +00:00
Campbell Barton
0767cdd4a0 Transfer Shape Key
Useful if you have 2 different characters with the same base mesh (matching indicies), and want to copy a facial expression for eg, from one to another.
Durian request to re-use shapes between characters. 

* Copies the active shape to other selected objects
* Different methods to apply the shape
* * OFFSET, simple translation offset
* * RELATIVE (EDGE/FACE), Use Barycentric transformation to copy the shape. This means the target mesh can be a different orientation and scale and the shape should still apply since the surrounding geometry is used as a basis for the offset.

bug: barycentric transform's depth was inverted.

Note:
* This isnt added into a menu yet,
* This cant be redone since adding a shape key messes up the redo stack. needs fixing for other scripts too.
2009-12-27 11:14:06 +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
bb094b8655 key shortcits for sculpt back
- T was 'Flatten Brush', now Shift+T
- added an option to OBJECT_OT_subdivision_set to set the level relatively (so page up/down works), however RNA lets it set one level higher then the maximum, this seems displays OK in the 3D view so not sure whats going on here (as if there is always an extra hidden multires level).
2009-12-23 12:13:48 +00:00
Campbell Barton
5bdcb2dff2 py error fix and minor changes to rna info class 2009-12-21 23:14:16 +00:00
Campbell Barton
de7ffa1bac make subsurf keys - Ctrl+1,2,3,4, apply to all selected objects. not just the active ones 2009-12-18 23:17:23 +00:00
Brecht Van Lommel
7b70ec6b9d Fix #20356: ctrl+1/2/.. could set multires levels outside limits. 2009-12-14 14:08:04 +00:00