1
2
3 """
4 The Blender.Modifier submodule
5
6 B{New}:
7 - Supports the new Cast and Smooth modifiers.
8
9 This module provides access to the Modifier Data in Blender.
10
11 Example::
12 from Blender import *
13
14 ob = Object.Get('Cube') # retrieve an object
15 mods = ob.modifiers # get the object's modifiers
16 for mod in mods:
17 print mod,mod.name # print each modifier and its name
18 mod = mods.append(Modifier.Types.SUBSURF) # add a new subsurf modifier
19 mod[Modifier.Settings.LEVELS] = 3 # set subsurf subdivision levels to 3
20
21
22 Example::
23 # Apply a lattice to an object and get the deformed object
24 # Uses an object called 'Cube' and a lattice called 'Lattice'
25
26 from Blender import *
27 ob_mesh= Object.Get('Cube')
28 ob_lattice= Object.Get('Lattice')
29
30 myMeshMod = ob_mesh.modifiers
31 mod = myMeshMod.append(Modifier.Types.LATTICE)
32 mod[Modifier.Settings.OBJECT] = ob_lattice
33
34 ob_mesh.makeDisplayList() # Needed to apply the modifier
35
36 Window.RedrawAll() # View the change
37
38 deformed_mesh= Mesh.New()
39 deformed_mesh.getFromObject(ob_mesh.name)
40
41
42 # Print the deformed locations
43 for v in deformed_mesh.verts:
44 print v.co
45
46
47
48 @type Types: readonly dictionary
49 @var Types: Constant Modifier dict used for L{ModSeq.append} to a
50 modifier sequence and comparing with L{Modifier.type}:
51 - ARMATURE - type value for Armature modifiers
52 - ARRAY - type value for Array modifiers
53 - BOOLEAN - type value for Boolean modifiers
54 - BUILD - type value for Build modifiers
55 - CURVE - type value for Curve modifiers
56 - MIRROR - type value for Mirror modifiers
57 - DECIMATE - type value for Decimate modifiers
58 - LATTICE - type value for Lattice modifiers
59 - SUBSURF - type value for Subsurf modifiers
60 - WAVE - type value for Wave modifiers
61 - EDGESPLIT - type value for Edge Split modifiers
62 - DISPLACE - type value for Displace modifiers
63 - SMOOTH - type value for Smooth modifiers
64 - CAST - type value for Cast modifiers
65
66 @type Settings: readonly dictionary
67 @var Settings: Constant Modifier dict used for changing modifier settings.
68 - RENDER - Used for all modifiers (bool) If true, the modifier is enabled for rendering.
69 - REALTIME - Used for all modifiers (bool) If true, the modifier is enabled for interactive display.
70 - EDITMODE - Used for all modifiers (bool) If both REALTIME and EDITMODE are true, the modifier is enabled for interactive display while the object is in edit mode.
71 - ONCAGE - Used for all modifiers (bool) If true, the modifier is enabled for the editing cage during edit mode.
72
73 - OBJECT - Used for Armature, Lattice, Curve, Boolean and Array (Object)
74 - VERTGROUP - Used for Armature, Lattice, Curve, Smooth and Cast (String)
75 - LIMIT - Array and Mirror (float [0.0 - 1.0])
76 - FLAG - Mirror and Wave (int)
77 - COUNT - Decimator Polycount (readonly) and Array (int)
78 - LENGTH - Build [1.0-300000.0] and Array [0.0 - 10000.0] (float)
79 - FACTOR - Smooth [-10.0, 10.0] and Cast [-10.0, 10.0] (float)
80 - ENABLE_X = Smooth and Cast (bool, default: True)
81 - ENABLE_Y = Smooth and Cast (bool, default: True)
82 - ENABLE_Z = Smooth and Cast (bool, default: True)
83 - TYPES - Subsurf and Cast. For Subsurf it determines the subdivision algorithm - (int): 0 = Catmull-Clark; 1 = simple subdivision. For Cast it determines the shape to deform to = (int): 0 = Sphere; 1 = Cylinder; 2 = Cuboid
84
85 - LEVELS - Used for Subsurf only (int [0 - 6]). The number of subdivision levels used for interactive display.
86 - RENDLEVELS - Used for Subsurf only (int [0 - 6]). The number of subdivision levels used for rendering.
87 - OPTIMAL - Used for Subsurf only (bool). Enables Optimal Draw.
88 - UV - Used for Subsurf only (bool). Enables Subsurf UV.
89
90 - OBJECT_OFFSET - Used for Array only (Object)
91 - OBJECT_CURVE - Used for Array only (Curve Object)
92 - OFFSET_VEC - Used for Array only (3d Vector)
93 - SCALE_VEC - Used for Array only (3d Vector)
94 - MERGE_DIST - Used for Array only (float)
95
96 - INVERT_VERTGROUP - Used for Armature only (bool)
97 - ENVELOPES - Used for Armature only (bool)
98 - VGROUPS - Used for Armature only (bool)
99 - QUATERNION - Used for Armature only (bool)
100 - B_BONE_REST - Used for Armature only (bool)
101 - MULTIMODIFIER - Used for Armature only (bool)
102
103 - START - Used for Build only (int)
104 - SEED - Used for Build only (int)
105 - RANDOMIZE - Used for Build only (bool)
106
107 - AXIS_X - Used for Mirror only (bool)
108 - AXIS_Y - Used for Mirror only (bool)
109 - AXIS_Z - Used for Mirror only (bool)
110
111 - RATIO - Used for Decimate only (float [0.0 - 1.0])
112
113 - STARTX - Used for Wave only (float [-100.0 - 100.0])
114 - STARTY - Used for Wave only (float [-100.0 - 100.0])
115 - HEIGHT - Used for Wave only (float [-2.0 - 2.0])
116 - WIDTH - Used for Wave only (float [0.0 - 5.0])
117 - NARROW - Used for Wave only (float [0.0 - 10.0])
118 - SPEED - Used for Wave only (float [-2.0 - 2.0])
119 - DAMP - Used for Wave only (float [-MAXFRAME - MAXFRAME])
120 - LIFETIME - Used for Wave only (float [-MAXFRAME - MAXFRAME])
121 - TIMEOFFS - Used for Wave only (float [-MAXFRAME - MAXFRAME])
122
123 - OPERATION - Used for boolean only (int 0,1,2 : Intersect, Union, Difference)
124
125 - EDGESPLIT_ANGLE - Used for edge split only (float 0.0 - 180)
126 - EDGESPLIT_FROM_ANGLE - Used for edge split only, should the modifier use the edge angle (bool)
127 - EDGESPLIT_FROM_SHARP - Used for edge split only, should the modifier use the edge sharp flag (bool)
128
129 - UVLAYER - Used for Displace only
130 - MID_LEVEL - Used for Displace only (float [0.0, 1.0], default: 0.5)
131 - STRENGTH - Used for Displace only (float [-1000.0, 1000.0, default: 1.0)
132 - TEXTURE - Used for Displace only (string)
133 - MAPPING - Used for Displace only
134 - DIRECTION - Used for Displace only
135
136 - REPEAT - Used for Smooth only (int [0, 30], default: 1)
137
138 - RADIUS - Used for Cast only (float [0.0, 100.0], default: 0.0)
139 - SIZE - Used for Cast only (float [0.0, 100.0], default: 0.0)
140 - SIZE_FROM_RADIUS - Used for Cast only (bool, default: True)
141 - USE_OB_TRANSFORM - Used for Cast only (bool, default: False)
142 """
143
145 """
146 The ModSeq object
147 =================
148 This object provides access to list of L{modifiers<Modifier.Modifier>} for a particular object.
149 Only accessed from L{Object.Object.modifiers}.
150 """
151
153 """
154 This operator returns one of the object's modifiers.
155 @type index: int
156 @return: an Modifier object
157 @rtype: Modifier
158 @raise KeyError: index was out of range
159 """
160
162 """
163 Returns the number of modifiers in the object's modifier stack.
164 @return: number of Modifiers
165 @rtype: int
166 """
167
169 """
170 Appends a new modifier to the end of the object's modifier stack.
171 @type type: a constant specifying the type of modifier to create. as from L{Types}
172 @rtype: Modifier
173 @return: the new Modifier
174 """
175
177 """
178 Remove a modifier from this objects modifier sequence.
179 @type modifier: a modifier from this sequence to remove.
180 @note: Accessing attributes of the modifier after removing will raise an error.
181 """
182
184 """
185 Moves the modifier up in the object's modifier stack.
186 @type modifier: a modifier from this sequence to remove.
187 @rtype: None
188 @raise RuntimeError: request to move above another modifier requiring
189 original data
190 @note: Accessing attributes of the modifier after removing will raise an error.
191 """
192
194 """
195 Moves the modifier down in the object's modifier stack.
196 @type modifier: a modifier from this sequence to remove.
197 @rtype: None
198 @raise RuntimeError: request to move modifier beyond a non-deforming
199 modifier
200 @note: Accessing attributes of the modifier after removing will raise an error.
201 """
202
204 """
205 The Modifier object
206 ===================
207 This object provides access to a modifier for a particular object accessed
208 from L{ModSeq}.
209 @ivar name: The name of this modifier. 31 chars max.
210 @type name: string
211 @ivar type: The type of this modifier. Read-only. The returned value
212 matches the types in L{Types}.
213 @type type: int
214 """
215
217 """
218 This operator returns one of the modifier's data attributes.
219 @type key: value from modifier's L{Modifier.Settings} constant
220 @return: the requested data
221 @rtype: varies
222 @raise KeyError: the key does not exist for the modifier
223 """
224
226 """
227 This operator modifiers one of the modifier's data attributes.
228 @type key: value from modifier's L{Modifier.Settings} constant
229 @raise KeyError: the key does not exist for the modifier
230 """
231