Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Metaball.py « doc « api2_2x « python « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e00cabe051fd69225b28967ce596d1469ecd545 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# Blender.Metaball module and the Metaball PyType metaball

"""
The Blender.Metaball submodule

This module provides access to the B{Metaball Data} in Blender.

Example::
 import Blender

 ob =  Blender.Object.New("Mball","mb")
 mb = Blender.Metaball.New()
 for i in range(20):
   mb.addMetaelem([0, float(i),1.0,1.0, 2.0,1,2.0,1.0,1.0,1.0])
 ob.link(mb)
 sc = Blender.Scene.getCurrent()
 sc.link(ob)
"""


def New (name):
  """
  Creates a new Metaball.
  @type name: string
  @param name: The name of the metaball. If this parameter is not given (or not valid) blender will assign a name to the metaball.
  @rtype: Blender Metaball
  @return: The created Metaball.
  """

def Get (name):
  """
  Get the Metaball from Blender.
  @type name: string
  @param name: The name of the requested Metaball.
  @rtype: Blender Metaball or a list of Blender Metaballs
  @return: It depends on the 'name' parameter:
      - (name): The Metaball with the given name;
      - ():     A list with all Metaballs in the current scene.
  """

class Metaball:
  """
  The Metaball object
  ===================
  This metaball gives access to generic data from all metaballs in Blender.
  @cvar name: The name of the metaball.
  @cvar loc: The location of the metaball.
  @cvar rot: The rotation of the metaball.
  @cvar size: The size of the metaball.
  """

  def addMetaelem(paramslist):
    """
    Add a new metaelem to this metaball. 'paramslist' must have the
    following ten elements:
      - param 1: int - metaelem type:
        - 0 for a sphere
        - 1 for a tubex
        - 2 for a tubey
        - 3 for a tubez
        - 4 for a regular tube
        - 5 for a plane
        - 6 for an ellipsoid
        - 7 for a cube
      - params 2,3,4: floats - the x, y and z coordinates of the metaelem.
      - param 5: float - the rad value of the metaelem.
      - param 6: int - the lay value.
      - param 7: float - the s value of the metaelem.
      - params 8,9,10: floats - the expx, expy and expz values of the metaelem.
    @type paramslist: list
    @param paramslist: the list of the parameters for creating a new metaelem.
    @rtype: None
    @return:  None
    """

		
  def getMetaElemList():
    """
    retreives the list of the Metaelems of the Metaball
    @rtype: List
    @return:  List of Metaelem classes
		Each Metaelem object has NO function, but 4 read/write fields\n
		coords : a list of three floats, the coordinates of the Metaelem object\n
		dims :  a list of three floats, the dimensions of the meteelem object\n
		rad : a float, the radius of the object\n
		stif : a float, the stifness of the object\n
		Example : \n
		import Blender\n

		mb = Blender.Metaball.Get("mball")\n
		ob = Blender.Object.Get("ob")\n
		ll =  mb.getMetaElemList()\n
		me = ll[0]\n
		old = me.coords\n
		new = [old[0],old[1],old[2]-.02]\n
		me.coords = new\n

		ob.makeDisplayList()\n
		Blender.Window.QRedrawAll()
		"""

  def getName():
    """
    Retrieves the name of a metaball object.
    @rtype: string
    @return:  the name of a metaball object.
    """

  
  def setName(name):
    """
    Sets the name of a metaball object.
    @type name: string
    @param name : the new name
    @rtype: None
    @return:  None
    """

  

  def getBbox():
    """
    Retrieves the bounding box of a metaball object.
    @rtype: a list of 24 floats(8 points, 3 coordinates)
    @return:  the bounding box of a metaball object
    """

  def getNMetaElems():
    """
    Retrieves the number of metaelems (elementary spheres or cylinders) of a metaball object.
    @rtype: int
    @return: number of metaelems of a metaball object
    """

  def getLoc():
    """
    Retrieves the location of a metaball object.
    @rtype: a list of 3 floats
    @return: location of a metaball object
    """

  def setLoc(newloc):
    """
    Sets the location of a metaball object.
    @type newloc: list of 3 floats
    @param newloc: the new location
    @rtype: None
    @return: None
    """

  def getRot():
    """
    Retrieves the rotation of a metaball object.
    @rtype: a list of 3 floats
    @return: rotation of a metaball object
    """

  def setRot(newrot):
    """
    Sets the rotation of a metaball object.
    @type newrot: list of 3 floats
    @param newrot: the new rotation
    @rtype: None
    @return: None
    """

  def getSize():
    """
    Retrieves the size of a metaball object.
    @rtype: a list of 3 floats
    @return: size a metaball object
    """

  def setSize(newsize):
    """
    Sets the size of a metaball object.
    @type newsize: list of 3 floats
    @param newsize: the new size
    @rtype: None
    @return: None
    """

  def getWiresize():
    """
    Retrieves the wiresize of a metaball object.
    @rtype: float
    @return: wire size a metaball object
    """

  def setWiresize(newsize):
    """
    Sets the wire size of a metaball object.
    @type newsize: float
    @param newsize: the new size
    @rtype: None
    @return: None
    """
  def getRendersize():
    """
    Retrieves the rendersize of a metaball object.
    @rtype: float
    @return: render size a metaball object
    """

  def setRendersize(newsize):
    """
    Sets the render size of a metaball object.
    @type newsize: float
    @param newsize: the new size
    @rtype: None
    @return: None
    """

  def getThresh():
    """
    Retrieves the threshold of a metaball object.
    @rtype: float
    @return: threshold of the metaball object
    """

  def setThresh(threshold):
    """
    Sets the threshold of a metaball object.
    @type threshold: float
    @param threshold: the new size
    @rtype: None
    @return: None
    """

  def getMetadata(name,num):
    """
    Retrieves the metadata of a metaball object. A metaball is composed of one or several elementary objects, spheres or cylinders, which interact to create the smooth surface everybody knows. The get/set Metadata functions allow users to read/write the parameters of these elementary objects, called metaelements.
    @type name: string
    @param name: the name of the property to be read. The accepted values are :"type", "x", "y", "z", "expx", "expy", "expz", "rad", "rad2", "s", "len".
    @type num: int
    @param num: the position of the metaelem to be accessed.
    @rtype: float
    @return: the metaelement parameter value, generally a float, except for the parameter "type", which returns an int.
    """

  def setMetadata(name,num,val):
    """
    The setMetadata function has the same semantics as getMetadata,   except that it needs  the parameter value, and always returns None.
    @type name: string
    @param name: the name of the property to be read. The accepted values are :"type", "x", "y", "z", "expx", "expy", "expz", "rad", "rad2", "s", "len".
    @type num: int
    @param num: the position of the metaelem to be accessed.
    @type val: float, except if name is "type".
    @param val: the new value of the parameter.
    @rtype: None
    @return: None
    """

  def getMetatype(pos):
    """
    Retrieves the type of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @rtype: int
    @return: type of the metaelem object
    """

  def setMetatype(pos,newtype):
    """
    Sets the type of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @type newtype: int
    @param newtype: the new type
    @rtype: None
    @return: None
    """

  def getMetax(pos):
    """
    Retrieves the x parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @rtype: float
    @return: x parameter of the metaelem object
    """

  def setMetax(pos,newx):
    """
    Sets the x parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @type newx: float
    @param newx: the new x parameter value
    @rtype: None
    @return: None
    """

  def getMetay(pos):
    """
    Retrieves the y parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @rtype: float
    @return: y parameter of the metaelem object
    """

  def setMetay(pos,newy):
    """
    Sets the y parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @type newy: float
    @param newy: the new y parameter value
    @rtype: None
    @return: None
    """

  def getMetaz(pos):
    """
    Retrieves the z parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @rtype: float
    @return: z parameter of the metaelem object
    """

  def setMetaz(pos,newz):
    """
    Sets the z parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @type newz: float
    @param newz: the new z parameter value
    @rtype: None
    @return: None
    """


  def getMetas(pos):
    """
    Retrieves the s parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @rtype: float
    @return: s parameter of the metaelem object
    """

  def setMetas(pos,news):
    """
    Sets the s parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @type news: float
    @param news: the new x parameter value
    @rtype: None
    @return: None
    """

  def getMetalen(pos):
    """
    Retrieves the len parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @rtype: float
    @return: len parameter of the metaelem object
    """

  def setMetalen(pos,newlen):
    """
    Sets the len parameter of a metaelem object.
    @type pos: int
    @param pos: the position of the metaelement
    @type newlen: float
    @param newlen: the new x parameter value
    @rtype: None
    @return: None
    """