Age | Commit message (Collapse) | Author |
|
blocks that were previously missed; and b) greatly increase my
ohloh stats!
|
|
practice in many real world cases, this can give more specific updates.
Discussed with Caedes, Brecht and Ton, can rework if needed.
|
|
I was careful in selectively rolling back revisions, but if you've committed changes unrelated to BPY mixed with BPY changes, I might have reverted those too, so please double check.
|
|
|
|
uses list sorting internally so is exactly the same as list sorting.
|
|
Revision: 11237
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11237
Author: campbellbarton
Date: 2007-07-12 13:05:31 +0200 (Thu, 12 Jul 2007)
Log Message:
-----------
PyObject_IsTrue was missing a check for an error return value in many cases.
|
|
subclass and C/subtypes work.
was reported as a bug a while ago.
|
|
METH_VARARGS everywhere and getting the single args from the tuple.
Use METH_O where applicable.
|
|
|
|
|
|
Data from Armature.c and logic.c still leaks.
Mostly todo with PyList_Append adding a refcount and the bpython api not decrefing.
Also added some features needed to fix a bug in mesh_clean.py (ob.pinShape and ob.activeShape)
|
|
from gen_utils and BPY_interface
small cleanup, removed unused functions and explicetly cast pointers..
|
|
way to access blender data
gen_utils was missing some type checks that made assigning a objects DupGroup and meshes texcomesh not work.
|
|
added a function - GenericLib_assignData for assigning blender data, to assign an ipo to a camera or world to a scene for instance.
Using this function removed ~300 lines of code.
also fixes user count error in some places that didnt check.
also made it possible to clear the colorband by setting it to []
|
|
mat.colorbandDiffuse
mat.colorbandSpecular
tex.colorband
gen_utils - removed unused func
|
|
|
|
python types can use.
removed a lot of code duplication when moving to this.
Also removed unused functions GetMaterialByName(), same for Mesh, Object, World etc.
|
|
* Moved to getsetattrs
* added scene.users (get)
* added scene.fakeUser (get/set)
* added scene.world (get/set)
* added scene.timeline (get)
* added scene.render (get)
* added scene.radiosity (get)
* added scene.objects.camera (get/set)
Group
* added properties
gen_utils
* made getScriptLinks work as documented, return an empty list rather then None.
header files, noted libdata after PyObject as a requirement.
Others,
* Deprecate prints for older functionality
EpyDocs still need updating.
|
|
* Added data.lib attributes to almost all data types, (except for Text3d and NLA)
This is None or the path of the library as a string.
* Main was giving a warning, Include Curve.h rather then CurNurb.h
* Added Library.LinkedLibs(), returns a list of externaly linked libs.
|
|
This isnt needed because the limit is alredy being set by rename_id()
some other minor changed- use None returning maro
|
|
gen_utils - needed to include BKE_library.h
off_import - use ed.key
|
|
|
|
|
|
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)
|
|
vec.normalized()
mat.inverted()
mat.transposed()
made vec/float possible
normalize/invert/transpose now return None because they modify the data in place.
use the ...(ed) versions to return a modified copy.
Fixed Memory leaks from not decreffing PyFloat_AS_DOUBLE from these python functions...
(found when testing above functions)
ob.rbMass
ob.rbRadius
matrix.determinant()
quat*float
vec*float
matrix.transpose()
EXPP_setModuleConstant
Checked all instances of PyFloat_AS_DOUBLE so I dont think there are any mroe leaks there.
|
|
Make EXPP_setBitfield() PyObject_IsTrue() to evaluate parameter, so
boolean-type attribute setters will accept wider range of true/false inputs.
|
|
they only differ by return type, so it's easier to just call
PyErr_Format and return appropriately.
|
|
longer linked to a script would cause a crash. We now delete all
scriptlinks which are not linked.
|
|
PyDict_SetItemString() with objects that were not properly decrefed
afterwards. Due to the number of places this was used, I added a
wrapper EXPP_dict_set_item_str() to gen_utils.c to handle it.
This started as a scriptlink bug, due to how many times scripts were
being executed I think it just magnified how bad the memory leak in
BPy was. Animating the blend attached with this bug report would cause
memory to grow by about 3MB for every 280 frames. After the patch,
memory did not appear to grow at all (or at least not noticably using
Unix's ps and top utils).
Since many of the PyDict_SetItemString() calls were in initialization
modules I think my tests executed most of the changed code, but would
appreciate script users really giving feedback.
|
|
* ==, != are defined for matrix, quat, euler.
|
|
- Fix incorrect usage of PySequence_Fast_GET_ITEM()
- make EXPP_setFloatRange() convert its argument to float instead of short
|
|
Warning clean up of python project
|
|
for these modules. Adds some new convenience funcs to gen_utils.
This is internal change only and presents little change to the
BPy API except for cleanup of some inconsistencies.
A big contribution from Ken Hughes. Thanks!
|
|
A nice juicy chunk of new style attribute handling from Ken Hughes.
Thanks, Ken.
|
|
- give it the key/items interface
- creates some factory functions for const generation
- genutils methods
- method for getting module constants
- method for throwing errors with a print string
- updates to function names
- clean up interpreter launch a bit
|
|
- Mostly this cleans up the #includes and header files in the python project.
- Warning fixes are mostly casting issues and misc fixes. General warning clean up.
- #include Python.h MUST come as the first include to avoid the POSIX redefine warning in the unix makefiles
- fno-strict-aliasing flag added to makefile to fix a unavoidable type punning warning in types.c
|
|
- also included is some fixes for preprocessor inclues and some clean up of the previous commit
-rewrite and bugfixes
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence. index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example: mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
* otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
|
|
|
|
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence. index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example: mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
* otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
|
|
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
|
|
warned about this...)
|
|
- based on a request by Campbell (he also provided a patch for scene.Layer) access to layers was improved a little, keeping the old method (ob.Layers is a bitmask) and adding the nicer one (ob.layers is a list of ints). Done for objects and scenes. House-cleaning: .Layer was renamed to .Layers (actually just using strncmp instead of strcmp, so both work, same done for Window.ViewLayers).
- finally committing patch by Ken Hughes to let .clearScriptLinks() accept a parameter (list of strings) to clear only specified texts.
- doc updates and fixes (JMS reported a problem in nmesh.transform() example code).
Thanks all who contributed.
|
|
|
|
- added BLI_str[n]casecmp, use instead of regular versions
- rewrote BLI_str[n]casecmp to not be stupid
|
|
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
|
|
|
|
- applied Campbell Barton's patch for access to Oops location and selection of materials, mesh data and objects, slightly modified. Thanks, Campbell;
- got rid of warnings in many files, hopefully not introducing any other during the process. Mostly this was done: 1) new EXPP_incr_ret_True/False functions were added and used instead of "Py_INCREF(Py_True/False); return Py_True/False;". Currently at least the functions use the fact that PyTrue/False == 1/0 and use 1 and 0 to avoid the warnings. 2) Filling of certain types structs got 0's added for all not defined data and methods. This is surely Python version specific, since these structs can change size and content at each major version number Python update.
|
|
Run everything thru indent to cleanup spaces vs tabs.
Clean up some of the comments by hand.
BGL.c was not touched due to all that macro wackyness.
There are no functional changes to the code.
Pre-indent versions of source are tagged with
tag bpy-cleanup-20040925 , just in case.
|
|
- small updates to the docs;
- Object: small fix to getMatrix: check during_script() to avoid undesired loops; added old behavior (pre 2.34) as option: .getMatrix('oldlocal');
- tentative fix for bug #1275: scene REDRAW scriptlinks were not being executed (the call to do so was missing):
http://projects.blender.org/tracker/index.php?func=detail&aid=1275&group_id=9&atid=125
added the call in drawview.c, in drawview3dspace(). This causes the scriptlink to be called for each visible view3d, but that's what happens with object redraw scriptlinks, too. Anyway, this is still a test. The place was chosen based on the idea that a scene redraw scriptlink is like an object redraw one, but for all objs in the scene at once.
- Window.Theme: new submodule, to get/set theme options in Blender;
- Added the script save_theme.py (Help menu for now), to save the current theme in Blender as an executable script (currently shown in the Scripts->Misc menu).
There's more work to do for themes, like defining a proper place for them in the interface, adding documentation (for now the added script and the ones it generates can give a pretty good idea of how to use the new module), probably extending themes to support SpaceScript and so on.
|
|
Add cvs $Id tag to files
|