Commit Graph

1170 Commits

Author SHA1 Message Date
ef56538c62 removed warning in last commit 2006-11-13 17:55:06 +00:00
26ef99157e made mesh.getFromObject() accept a python object as well as the object name.
accepting the name only was causing big problems when exporting library data, because duplicate names are possible the wrong data was exporting.
2006-11-13 17:37:01 +00:00
Nathan Letwory
008d6987d0 move SPACE_* (enum) and SPACEICONMAX to DNA_space_types (being the more logical place than DNA_screen_types). SPACEICONMAX gets its value now through this enum, so it is not anymore easy to forget to update it correctly :) 2006-11-07 11:24:11 +00:00
b48c514db8 Added an option in the IK constraint to disable stretching, useful
in rigs with layered IK constraints. Also removed the tolerance
setting, this value wasn't used in the solver anymore.
2006-11-06 23:51:37 +00:00
4545da3510 ack- need to get the hang of usercounts better- it seems they need to be initialized as 1 for groups, just like images. 2006-11-02 23:05:10 +00:00
80ffbee6f7 was missing a return of len, so scn.objects.context was always returning 0 2006-10-25 13:33:08 +00:00
0e569035c7 made mesh getFromObject also copy the meshes flag 2006-10-22 02:43:04 +00:00
045e143189 a Malifico request, Blender.Library now supports loading relative libraries.
Blender.Library.Open('//someblend.blend')

the // at teh start of the path mean that the file will be loaded relaive to the existing blend files path.
2006-10-15 14:00:23 +00:00
3b0adf0bf4 added shadAlpha access to materials in python 2006-10-15 08:43:59 +00:00
c8b06bba9c mesh/animation exporters didnt work when there were no 3d views open, because the Blender.Set('curframe', i) called a update command that resulted in no viewable layers updating.
Made Blender.Set('curframe', i) do a
  scene_update_for_newframe(G.scene, (1<<20) - 1);

  removed 2 unused constants from Scene.c
2006-10-13 11:56:08 +00:00
ce0f9a3cac On Matt's suggestion moved "Make Link->Groups" to the add groups menu as "Add to Active Objects Groups"
removed "Make Link -> DupliGroup" because Copy->Duplis does the same thing.

Python's Group.c had an unneeded scene/base lookup.
2006-10-12 13:13:45 +00:00
de3c54569d BPyRender sets renderlayers right now
Object groups were get/set without user counts changeing.
2006-10-11 10:33:34 +00:00
0ed327f162 Setting new objects scenes layers is & (1<<21)-1
the scenes active object is only unset when unlinking - if the active object is being removed.
2006-10-11 03:02:35 +00:00
e4c38c5740 changed python scn.Layers get/set to mask off bits other then (1<<20)-1 2006-10-10 04:54:02 +00:00
6e61448123 Mistake in recent schange to scn.objects.new() crashed Blender. fixed and also stopped Mesh_FromPyObject() clearning a meshes object if not called with an object. 2006-10-10 02:18:08 +00:00
0933418617 Lattice.c was looping through all lattice data to check that it wasnt removed.
No other BPyModules do this and zero user lattices are kept so this check is not needed.

removed lattice.applyDeform(), this called object_apply_deform, which only gave a message to use modifiers.

changed the example in epydocs to apply the lattice using modifiers.
2006-10-09 06:19:27 +00:00
27dc45ba24 BPyRender.imageFromObjectsOrtho's now sets all layers visible,
an error in Scene.c - scn.Layers disallowd all layer bits to be set.

made image_billboard.py rotate all images to be verticle for more efficient packing, added the option not to pack resulting images into 1.
2006-10-09 04:29:24 +00:00
29daa64095 removed unusued vars from Geometry.c
uv_archimap still had python based line intersect

added plane2matrix function to BPyMathutils
added an optional arg to imageFromObjectsOrtho - camera_matrix
camera_matrix can be used to define a plane in 3d space where X and Y scale is used to set the width and height of the area to render.
2006-10-08 10:51:38 +00:00
b3a48fe82e removed some unused vars from Curve and matrix
scn.objects.new(None) - adds a new empty
 - new objects are selected by default now

further stripped down the vector struct, the wrapped state was being stored and 2 places.
2006-10-07 11:49:53 +00:00
30d207e650 Added python func Blender.Geometry.LineIntersect2D(v1,v2,v3,v4)
updated archimap and cookie cutter to use it, removed python version from BPyMathutils
archimap island merging is noticibly faster
2006-10-07 04:56:36 +00:00
dda63a9dde added comparison function to many python types so you can do == and =! 2006-10-06 16:48:28 +00:00
4811ba51ed Python API
added list like access to mesh face colors so you can say col[0] = 255 instead of col.r= 255
more importantly 'for ch in col' and 'tuple(col)'
2006-10-05 15:56:11 +00:00
3bd71e9ad5 added the option to Blender.Library to 'link' data for malefico 2006-10-05 15:24:15 +00:00
0c6bb8c079 mesh.transform() was applying the inverted 4x4 matrix to the normals, without removing the translation part.
iter with a char value did not allow for -1, my bad, using short now.
2006-10-04 17:06:29 +00:00
5dcf97c892 moved vector objects to getseters,
added in place operations.
  Vector_iadd   vec1+=vec2
  Vector_isub   vec1-=vec2
  Vector_imul   vec1*=float or vec1*=mat
  Vector_idiv   vec1/=float

length is now writable vec.length= float
2006-10-03 16:07:48 +00:00
6b7c4e09e8 Mathutils.Vector speedup
removed the need for casting python objects to Vectors pyobjects when performing vec/float arithmatic.
a PyObject for coercing has also been removed from the vector struct so a little less memory will be used also.


Benchmarked before and after this change
___________________________________
import Blender
v= Blender.Mathutils.Vector
m= Blender.Mathutils.Matrix

a= v(1,2,3)
b= v(3,2,1)
c= m()
t= Blender.sys.time()
for i in xrange(20000000):
        a*b
        a*10
        a/10
        a+b
        b-a
        a*c

print Blender.sys.time()-t
_______________________________________

Before 63.5sec
after 49.5

about 3 sec of that is looping
2006-10-03 05:11:33 +00:00
32b1e2383b 3rd attempt to commit, metaball fixes and small vector optimization 2006-09-30 14:14:49 +00:00
b4e97c01ff -> Enter/Exit editmode wait cursor flags
The wait cursor was being called during editmode enter and exit for meshes.
This was a problem for several reasons. First of all, python modules like
Mesh now make use of editmode features. These methods that wrap editmode
tools may be called many times during the execution of a script
and lead to the wait cursor rapidly flickering on and off.

The other problem was that the wait cursor wasn't being called for editmode
enter and exit of all data types. This is unified now.

-New Arguments

enter_editmode() should be passed a nonzero integer or simply EM_WAITCURSOR
if the wait cursor is desired. Currently only the python API passes a '0'
to enter_editmode()

exit_editmode() has several options and they are passed in as the bitflags
EM_FREEDATA, EM_FREEUNDO and EM_WAITCURSOR. These flags are defined in
BDR_editobject.h.
2006-09-28 01:55:44 +00:00
ad51edd3bf Adding MDD import and export from patch 4969 with modifications, (import and export rvks, MDD is from lightwave AFAIK)
Added Mesh .key .removeAllKeys() and .insertKey() for MDD support (was using NMesh just for keys before)
Since this is aparently an experemental feature in NMesh we may want to change this.
2006-09-27 16:33:02 +00:00
e6251f6ae7 removed .parent by mistake in Object.c
made some of the importers raise a nice error if a file disnt exist rather then a python error. will eventually apply to all.
2006-09-26 04:39:46 +00:00
65895ba6bd corrected image doc mistake - image.makeCurrent()
BPyRender.imageFromObjectsOrtho() returns an image

Made all image bake scripts ask before overwriting a file. as well as displaying the newly created image once its rendered.
2006-09-25 19:35:43 +00:00
db7c3d3271 A possible problem was noted by Cyril Brulebois regarding copyright issues
with regards to the noise functions in yafray based on Ken Musgrave's
original code.
I had left the 'Copyright' notice in the comments, and according to
Cyril Brulebois this is a problem. In fact, from what I understand this
makes it even impossible to use or modify the code in other software.
But since it is not a verbatim copy of the code but rather based on Musgrave's
work, he suggested I change it to explicitely state that it is in fact
based on the code from the 'Texturing & Modeling' book.
And since the yafray code is in turn based on the blender code, I better
adapt the blender code too.

This reminded me that I also have forgotten to include the copyright notice
in the mersenne twister rng code I used for the Python Noise module.
This does clearly state to include the original notice with any resdistributed
code, in modified form or not. So I added that too.

I hope that solves the problems.
2006-09-25 04:54:45 +00:00
7f7f35d1ca fixed mistakes and warnings in previous commit. 2006-09-24 09:21:18 +00:00
e8495d1fdd Extra generic errors for Scene, Groups and Metaballs to raise errors when trying to do anything with a python objects thats had its data removed in Blender.
Added to existing scn.objects
scn.objects.active    (get/set the active object for the scene)

scn.objects.selected    - an iterator that only uses selected objects
scn.objects.context    - an iterator on objects in the user context (visible in the current 3d views layer and selected)
These are the same type as scn.objects but .add() .remove() .new() .active etc raise errors. so scn.objects.selected.add() will raise an error.

Made nested loops possible with scn.objects, metaball.elements and ob.modifiers, by initializing the iter value as NULL and creating copys of the pyobject when _getIter() is called if ->iter is not NULL.
This is how pythons xrange() works.
2006-09-24 08:30:38 +00:00
d728cd1a52 new read only object property to be used for the collada exporter
ob.parentType and a constant dict Blender.Object.ParentTypes
2006-09-23 15:07:03 +00:00
4725ca6c02 This commit adds local target rotation support to the floor constraint,
making it much more useful. Requested and taunted for frequently by
Plumiferos folks. Click on "Use Rot" to take target object rotations
into account.

Good for using rotated empties, etc., as a sloped floor.
2006-09-22 15:57:58 +00:00
3d3b64768d Mesh iterators (me.faces, me.edges, me.verts, face and edge iterator) store the iterator progress in the python object.
This made nested loops with the same python object mess up.
eg-
faces= me.faces
for f1 in faces:
  for f2 in faces:
    print f1.index,f2.index

This didnt work, fixed by initializing the iter value at -1, so any greater value will create a new BPyObject with its own iter value.
once iteration is finished, its set back to -1.

Also made face and edges iter value a char instead of an int to save some memory.
2006-09-22 10:08:41 +00:00
d82f1f5f91 from looking at patch 4934 made all user preference paths settable with Blender.Set('val', data), also added exception errors which were on the todo.
image.filename was being limited to FILE_MAXDIR rather then FILE_MAXDIR + FILE_MAXFILE when setting.
2006-09-21 18:25:40 +00:00
95c185c4c5 Setting the image name was raising an error. 2006-09-21 17:03:24 +00:00
78e1426835 removed warning in EXPP_setVec3Clamped 2006-09-20 17:30:47 +00:00
27848c8f08 order of case statement was messed up with previous commit. 2006-09-19 10:52:56 +00:00
66bc9589a5 Type in docs and element.quat was checking for a vector type. 2006-09-18 02:33:00 +00:00
5f21cab631 corected some mistakes in the metaball docs. 2006-09-17 08:36:43 +00:00
d89240ba12 added mesh_create_derived_view(ob) to DerivedMesh.c
exactly the same as mesh_create_derived_render(ob) except it uses the view modifier settings.

Added an optional arg to getFromObject to 'render' so you can choose to get the mesh displayed in the 3d view or generate one with render settings.
Solved bug 4612 getFromObject now works with soft body meshes (error was caused by getting the derived mesh from a copy of the object)

removed workaround for softbody bug in object_apply_def.py
2006-09-17 05:15:56 +00:00
e472a3d852 renamed Blender.Image.SetCurrent(img) to img.makeCurrent() to be consistant with scene.
applied patch #4998 (array count), as well as adding other array settings, updated documentation as well.
added EXPP_setVec3Clamped() as a way to set a vector from getset attrs (used with array offset and scale)
2006-09-17 02:31:16 +00:00
c7d39e1a06 New images were being initialized with zero users (normal for other data types),
but for images user counts work differently.
(just noticed this is what blender does so Image.New() now does the same)

Many of the sys functions had maximum path thengths that were too short.
  char path[FILE_MAXFILE];
rather then
  char path[FILE_MAXDIR + FILE_MAXFILE];
2006-09-16 10:05:57 +00:00
e6960f3881 Python Metaballs api refactor, based on Mesh and Group modules.
* removed get/set in favor of setsetattrs
* added an element iterator to the metaball data type.
* now accepts vectors and quat for location dimensions and rotation.
and other small changes.
Docs updated shortly at.
http://members.iinet.net.au/~cpbarton/ideasman/BPY_API/Metaball-module.html

other changes
typo in image.c
metaballs constants in buttons_editing
2006-09-16 09:33:09 +00:00
2b7f09b8ea added Image.SetCurrent(img) and img.has_data so you can see if an image contains pixel info. 2006-09-16 06:18:41 +00:00
6dbf2ccf55 bug of mine fixed
didnt chech that a material existed before accessing it- crashed with null materials and mesh.getFromObject()
2006-09-15 14:52:59 +00:00
Ken Hughes
c3b9a550a3 ===Python API===
Internal code clean-up: make M_Object_New use existing code instead of
duplicating the steps of object initialization/creation.
2006-09-11 17:55:52 +00:00