Age | Commit message (Collapse) | Author |
|
|
|
obvious solution
attr = Py_True; // Image.c:1107: warning: dereferencing type-punned pointer will break strict-aliasing rules
|
|
Image.New(name, w,h,depth)
Image.start- for animtex
Image.end - for animtex
Image.speed - for animtex
Image.packed - read only bool
See the pydocs for details.
|
|
|
|
You have to put Py_RETURN_NONE; inside { }; it's a two-line macro
Aparently breaks MacOS.
|
|
Previously the only way to get the current image was flaky and relyd on the image being assigned to a mesh.
try:
me = Scene.GetCurrent().getAttiveObject().getData(mesh=1)
image = me.faces[me.activeFace].image
except:
image = None
...Can new be replaced by the following, and works even when there is no mesh.
image = Image.GetCurrent()
epydocs:
Get the currently displayed Image from Blenders UV/Image window.
When multiple images are displayed, the last active UV/Image windows image is used.
|
|
- corrections to constants
- parameter type checking
- correct use of METH_VARARGS vs METH_NOARGS
- return objects instead of strings in Scene.getChildren() as per doc.
- correct logical operators
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
|
|
New Image methods from Austin Benesh:
- getPixelI(x, y)
- getMinXY()
- setPixelF(x, y, [r, g, b, a])
- setPixelI(x, y, [r, g, b, a])
- save()
sorry for the delay.
Thanks.
|
|
- 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
|
|
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
|
|
borrowed reference.
|
|
to match OpenGl conventions and prepare for integer versions.
|
|
.getPixel( x, y ) returns float list of [r, g, b, a] for pixel
.getMaxXY() returns image size as float list [x, y]
Contributed by Austin Benesh (mchs3d). Thanks!
also ran code thru indent.
|
|
NOTE: BLI_winstuff.h was meant to be a wrapper around windows.h to handle
undefining various crap that windows.h defines. Platform specific headers
should only have to be included in a few places. This reduces the number
of inclusions of BLI_winstuff.h to 16 which is a much more reasonable
number (than the 144 or whatever it used to be)
|
|
- 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.
|
|
- NMesh: made nmesh.update accept an optional 'vertex_shade' param to init vcols with shading info, like when you enter vpaint mode or press the relevant "make" button for a mesh without vcols. This is still a test, the functionality was requested by Manuel Bastioni for the SSS script they are working on:
http://www.dedalo-3d.com/index.php?filename=SXCOL/makehuman/articles/subsurface_scattering_in_python.html
- sys: made makename() accept files with max FILE_MAXDIR+FILE_MAXFILE name length, should fix #2192. Was only FILE_MAXFILE, a mistake;
- Image: added .setFilename(), contributed by Campbell Barton;
- Camera: added camera.get/setScale for the new param added by Ton for ortho cameras. Requested by Jean-Michel Soler for the Texture Baker script;
- related doc updates.
|
|
- Fix related to bug #2157: crash in Blender.Image.image.reload() method. "G.sima" was not being checked for validity. Fix by Joilnen B. Leite (pidhash). Thanks!
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2157&group_id=9
- Added optional argument to Blender.Object.object.getData() method: getData(only_name = True) or (only_name = 1) or (1) will return only the obdata name, not a wrapper for the given struct. This is a test based on a request by Campbell Barton who submitted code for his proposed .getDataName() method (thanks!).
- doc updates and small fixes.
|
|
- patch by Jonathan Merritt: new function Blender.Draw.Image() + its doc;
- patch by Campbell Barton: .users attribute for many types;
- tiny internal change in nmesh.hasVertexUV() method.
Thanks to Jonathan and Campbell for the patches and the patience!
|
|
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
|
|
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.
|
|
- added mainqenter to stubs.c so it can be used in blender/blenkernel/intern/blender.c's setup_app_data.
We can't run the onload scriptlink in setup_app_data because the visible areas won't have been updated and redrawn for the loaded .blend file until control returns to screenmain() in blender/src/editscreen.c. So an ONLOAD_SCRIPT event is entered in setup_app_data and caught in screenmain, where the onload script is then executed. All for a good looking demo mode ...
BPython:
- Added image.getBindCode() method, contributed by Andrew Corrigan (thanks!).
|
|
PythonReturnErrorObject
PythonIncRef
Fix some compiler warnings about missing initializers
in method tables.
|
|
- Campbell Barton contributed another function (thanks again), the Image.reload method:
with this a script can keep an image that is being edited and saved by an external program updated in Blender.
|
|
-- New module: Blender.Texture, by new developer Alex Mole.
Most of it is done: guess only Ipo, envmap, colorband and plugin were not implemented yet.
|
|
changed "get_ipo(key, ..." to "get_ipo((ID *)key, ..." in line 107.
* changed insert_meshkey(Mesh *me) to insert_meshkey(Mesh *me, short offline):
To call this function from a script, so that it doesn't pop the
"relative / absolute" dialog window when the "offline" arg is non-zero.
Exppython:
* NMesh module:
- Added method NMesh.addMaterial(mat) to the NMesh module:
alternative safer (aka slower) way to add materials.
- Added optional arg to NMesh_update():
if given and equal to 1, the mesh normals are recalculated.
- Fixed NMesh.getVertexInfluences: it was segfaulting when a NULL bone was
linked to the vertex. Thanks to Jiba on the bf-python mailing list for
bug report and sample .blend file. Also made this method give an IndexError
when the vertex index is out of range.
* Material module:
Added specR, specG, specB vars for compatibility with the 2.25 API.
Pointed by Manuel Bastioni.
* Image module:
Exposed image width, height and depth parameters.
From a suggestion by jms.
* BPython Ref Doc:
- Small updates to reflect the above additions.
- Added info for the Bone type in the Armature doc.
|
|
- More documentation files for epydoc.
- Few minor changes in other files.
|
|
- Continued getting rid of print methods and updating repr ones:
Needed to fix crashes on Windows >= 98 systems.
- Found and fixed a few small memory leaks in EXPP_interface, related to
execution of script links.
|
|
- Implemented partially Blender.Sys
- Worked on issues related to sys, path
- Took away most "debug" printfs
|
|
* Moved public declarations in camera and lamp to a new file: bpy_types.h.
* Fixed minor bugs in material, rgbTuple and Lamp + other minor changes.
* Made part of the changes to conform to decided naming conventions.
|
|
When a script that used setAttr for Camera Data objs (the bug also
affected some other modules) was executed multiple times, Blender
would crash after, let's say, the first 5 or 6 tries. Problem, as
Guignot pointed, was with reference counting. Should be ok now, all
affected modules were fixed.
* The Scene module is now "complete" (= 2.25).
* Made some necessary updates to Object and NMesh.
|
|
by Aphex - thanks.
* Added the doc strings to the Object module.
* Added more functionality to the Object module.
|
|
Added material and image handling/hooks and the constant dictionaries.
Changed Image.h and Material.h to only have public declarations, so
NMesh could include them.
|
|
Following a suggestion made by Jordi Rovira i Bonet, the comparison
now is made via the pointers to the Blender objects, not their py wrappers.
|
|
Partially implemented. Most of it comes from opy_nmesh.c, plus needed
changes to integrate in into exppython.
* Added helper submodule vector, needed by NMesh.
* Minor changes in other files.
|
|
Callbacks registered with Draw.Register in Python are called now.
That should fix submodule Blender.Draw.
* Added a few other missing functions to BPY_interface.c
* Finished implementing Get() function for Camera, Lamp, Image and Text:
Both the .Get(name) and .Get() cases are handled now.
* Added function Blender.ReleaseGlobalDict():
This function should give script writers control over whether the
global Python Interpreter Dict should be cleared after the script is
run (default is to clear). This is a test.
|
|
* Implemented submodule Text
|
|
Most of the code comes from bpython/intern/opy_window.c, but two
new functions were added, to access the file and image selector
windows in Blender.
* Added submodules Draw (gui) and BGL (OpenGL wrapper):
The code comes from bpython/intern/opy_draw.c, with minor changes
to integrate it in the new implementation.
* Made changes to Camera, Lamp and Image submodules:
The implementation was improved. These files should be good
starting points for interested new coders to look at, now.
* Renamed interface.[ch] to EXPP_interface.[ch] to avoid conflict:
There is another interface.h file in source/blender/include.
|
|
* Implemented BPY_end_python function.
* Implemented error handling. This results in rerunning a script after an
error has occurred. No need to restart blender anymore.
* Camera module supports dir()
* variable assignment now calls the Python equivalent function - this has
type checking and should be safer now.
* Implemented the Lamp module. Used the Camera module as a template.
* Implemented the Image module.
* Added EXPP_ClampFloat and EXPP_intError functions to gen_utils.[ch]
* Implemented 'constant' object.
|