Age | Commit message (Collapse) | Author |
|
|
|
|
|
approx 15-25x speedup
|
|
|
|
- bpy is now a python package, this makes it easier to add utility modules and adjust python startup which was previously using verbose Py/C api. Access should not be any slower since both C and Python modules use dictionary access.
- loop over scripts and load via python (currently F8 reload isnt working, will add back shortly)
- the C module is kept but renamed to _bpy and not meant for direct access from anything but the bpy package.
- bpy_types.py is an exception since it runs before the bpy package is initialized.
|
|
|
|
dimension conversion 1km-10cm+4ft
Note...
- Python3.1 you don't need to add the .0 for divisions anymore (was esp annoying for button eval)
- Simple dimension input, imperial mi/yd/ft/in, metric km/m/cm/mm, Later could display these values and have a pref for scene scale, atm it assumes 1BU == 1m.
|
|
they were not working and we have plans for better script integration in 2.5
|
|
Monthly cleaning round to make it compile warning free.
Mostly it was const stuff (strings, Context), but also
a couple useful fixes, like wrong use of temp pointers.
Only Mathutils callback struct I left alone... design issue.
|
|
|
|
Mostly harmless ones, except for one about "gzopen64" being
undeclared. This needs some defines in BLI_storage.h to be set
before <unistd.h> is included. Might fix a crash in compressed
file reading, though I'm not sure since it's hard to repeat
the crash consistently.
|
|
Send the full python stack trace to the reporting api,
added BPY_exception_buffer which temporarily overrides sys.stdout and sys.stderr to get the output (uses the io module in py3 StringIO in py2 to avoid writing into a real file), pity the Py/C api has no function to do this.
fix for crash when showing menu's that have no items.
|
|
F7 runs test.py also for testing
|
|
Now it is possible to write a Python Expression using the variable names for driver targets (see mockup from initial commit) to substitute the appropriate values into the expression.
In the __global__ namespace for PyDriver evaluation, the following modules are available:
* __builtins__ - i.e. the builtin Python functions
* bpy - new Python API
* math or m - math module
For example:
Consider a driver with three targets, named: A, B, C
Now, you could write an expression like:
C if A < 5 else B
or even:
2*C if A < 5 or A > 20 else m.PI*B
Of course, you don't have to have three targets, the above was just an example.
TODO:
* Bring back way to load pydrivers.py
* Blender.Noise equivalent would be nice to have
P.S. I hope I haven't made any terrible Python API coding errors here (i.e. mem leaks, etc.)
|
|
The bug was todo with bpy.data and bpy.types becoming invalid, temporary fix is to re-assign them to the bpy module before running python operators or panels.
will look into a nicer way to get this working.
|
|
made it crash when running the class functions. will look into this further.
|
|
this means it caches the compiled pyc files after importing fro the first time.
My times for importing 501 buttons_objects.py files were.
- running each as a script 1.9sec
- importing for the first time 1.8sec
- importing a second time (using pyc files) 0.57sec
Also added "bpy" to sys.modules so it can be imported.
|
|
* Added very basic loading of .py files on startup to define panels.
It now executes all .py files in .blender/ui on startup. Right now
this contains the object buttons, the C code for it is commented out.
These files should get embedded in the blender executable as well
eventually, that's a bit more complicated so this works for now.
* For scons and cmake it seems to copy & find the files OK, for make
only "make release" works (same with scripts/ folder it seems).
* Added BLI_gethome_folder function in BLI_util.h. This is adapted
from bpy_gethome, and gives the path to a folder in .blender like
scripts or ui.
There's plenty of things to figure out here about paths, embedding,
caching, user configs ...
|
|
- Register python panels
- Added a generic class checking function BPY_class_validate() for panels/operators.
- No button drawing yet
Brecht, Added RNA_enum_value_from_id() and RNA_enum_id_from_value() to rna_access.c to do lookups between identifiers and values of EnumPropertyItem's, Not sure if these should go here.
|
|
|
|
Can draw panels in the scripts space containing RNA and operator buttons.
* Added bpyui.register() so scripts can draw buttons and panels into the scripts space type.
* wrapped drawBlock, drawPanels and matchPanelsView2d
* Operator buttons take a python dictionary used to set the button defaults.
* BPY_getFileAndNum utility function to get the filename and line number python is currently running.
|
|
Added RNA wrapping for F-Curve colour settings
|
|
* Unicode calls in bpy_idprop.c were causing linking errors here. Probably Py-libs for windows would need recompiling with unicode before we can enable this. For now, commented out the offending calls.
|
|
"operator.ED_VIEW3D_OT_viewhome(center=1)" calls the operator, converting keyword args to properties.
Need a way to run scripts in the UI for useful testing.
Still need to deal with operator exceptions and verifying args against operator options.
Added temporary WM_operatortype_first() to allow python to return a list if available operators, can replace this with something better later (operator iterator?)
|
|
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
|
|
Patch #9673: "Short patch to make spacehandler event scripts work more like normal python gui script handlers" by Steven Truppe:
http://projects.blender.org/tracker/?func=detail&atid=127&aid=9673&group_id=9
This patch adds the Blender.eventValue variable available for space handlers, holding the event value (aka 1 for button and key presses, X or Y coordinate for mousex / mousey movement). Thanks, Steven. PS: this doesn't break existing scripts.
|
|
Bug #17599:
Summary: Python constraints, good in 2.46 not working anymore in 2.47
http://projects.blender.org/tracker/?func=detail&atid=125&aid=17599&group_id=9
Improved my old hack to avoid frame changed scriptlinks from running when rendering stills, should fix this bug. It also causes REDRAW scriptlinks to be executed during renders, but that conforms to how FRAMECHANGED ones work.
BTW: this can still be improved. The current system meant to disable all Python functionality at once needs imo to be replaced by one that allows to enable / disable per feature (scriptlinks, pyconstraints, pynodes, etc.). A better way to inform scriptlinks about what is going on (render, anim, render anim, etc.) would also help. Will discuss with others.
|
|
scripts can be relative to the current path.
- was alredy doing this for blendfiles, but better to have in its own function.
header_text.c - renamed PATH_MAX, was defined by system includes.
|
|
and scripts not being recompiled in some cases. Needs more thought before committing.
|
|
the text area. Errors in other files/scripts still pop up a message as before and all errors are still printed to the console. This removes the need to switch to the console for local errors.
|
|
text plugin scripts. Also created two more scripts to handle imports and member suggestions.
|
|
header. For a supported space type, the user may press this shortcut to invoke the script.
Space types that are to support shortcuts like this should call BPY_menu_do_shortcut(...) from the event queue read method (See winqreadtextspace in drawtext.c for example)
|
|
load factory settings and replaced elysiun with blenderartist.org in headers
|
|
blocks that were previously missed; and b) greatly increase my
ohloh stats!
|
|
segfaults Blender
|
|
scripts running when you open a blend file.
Also scripts will re-run on undo rather then closing.
This is done by saving and loading the name of the script or textblock of the 'Script' datablock, connected to the ScriptSpace. This way when there is a name but the script dosnt run.
Blender runs the script or text block if available.
|
|
Submitted by: Thomas Knight (epat)
Parts committed:
1) Fixed a few misspellings in some error strings.
2) Fixed a (theoretical) bug with pyconstraints where a text object could be deleted from python but would remain linked
to the constraint it was assigned to - causing slight UI usage discontinuities!
Not committed yet:
3) Particle system bugfix in this patch has not been committed. Could jahka or brecht check this.
|
|
Setting the user preference for python scripts didnt add the bpymodules subdirectory to sys.path (python module search path).
Also problems with entering and exiting- the old path was used until next restart.
|
|
is not loaded in background mode and the user preference is not validated and has no fallback.
'btempdir' is set with BLI_where_is_temp() - This tries to use U.tempdir but falls back to $TEMP or /tmp/
|
|
|
|
- removed editors/area and put this all in screen
- added first python calls (note, a new c file for scriptlinks)
- added view3d editor callbacks (no drawing yet)
- added files in editors/interface
(Cmake and Scons has to be fixed, help welcome!)
- now areas/headers are being converted on file read
- note: previously saved 2.50 files will crash!!! (.B.blend)
- area regions are being drawn, first handler for cursor added (on edge)
- window duplicate and scale works correct for screen subdiv
Todos for me:
- need to fix things in syntax (function names) a bit still
- more operators for screen
- define how Context will work... still unresolved when it gets set
- docs!
Reviews of code structure is welcome!
There are also more todos now for others, but it can wait a couple of days
|
|
Makefiles especially, and of course the windowmanager DNA!
|
|
adding new windowmanager module, and the first bits of new editors
module.
|
|
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
|
|
I've added the ability for PyConstraints to define a function (doDriver) that is able to directly modify values of the owner/target, so that certain setups can be created reliably. Users should take note that this is against the basic concept of what a constraint does, and that under no circumstances may they set the values of any variables controlling the transforms. For more details, check out the information in the PyConstraint template script.
I've also updated PyConstraints to be aware of geometry targets. The script template has been updated with this information.
|
|
This commit fixes the Draw module. All buttons/widgets created via the Draw
module in a SpaceScript area are now inserted into a global list attached to
the SpaceScript data. This list is cleared before each draw, when freeing
the space, and when the area is switched to another space.c
This is necessary to prevent Blender's internal UI code from getting invalid
pointers to python data. In addition, it allows storing widget tooltips
inside the python Button objects, which solves that little bit of stupidity.
Note that this reverts the previous weaklist solution. In fact, I had to go
over each previous commit by Campbell after this code originally branched
before the weaklist commit and re-add each commit. So if anything is
missing, just tell me, or feel free to re-add it.
|
|
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
|
|
At last! The ability to code constraints in Python. This opens up many interesting rigging possibilities, as well as making prototyping constraints easier.
* A PyConstraint script must begin with the line
#BPYCONSTRAINT
* It must also define a doConstraint function, which performs the core actions of the constraint.
* PyConstraints use IDProperties to store custom properties for each PyConstraint instance. The scripter can choose which of these ID-Properties to expose to a user to control the behaviour of the constraint. This must be done using the Draw.PupBlock method.
Credits to Joe Eager (joeedh) for coding the original patch on which this is based. I've made heavy revisions to large parts of the patch.
For more detailed information, and some demo scripts, see the following page:
http://aligorith.googlepages.com/pyconstraints2
|
|
Users can write any valid Python expression (that evals to an int or float) inside Blender's gui number buttons (preceded by #) and have them evaluated to their actual int or float value.
Button Evaluation has access to the same modules as PyDrivers.
For example:
#1.0*9-2.3
#ob("Camera").LocZ
#1.0/ob("Cube").LocX
#math.sin(math.pi) -- or simply #m.sin(m.pi)
etc
|
|
text module when user edits the input text box of any pydriver
(Transform Properties panel, Ipo window).
It's enough to click in and out of a single pydriver's text input box
for the module reloading and also re-evaluation of all pydrivers
available. Maybe this "refreshing" should also be available from a
menu, let's see.
Note for Python fans:
Definitions and redefinitions in a reloaded module are properly handled
in Python, but previously defined data in the module doesn't disappear.
So if you define a function "f" inside a module, import it, then change
the function's name to "g" and reload the module, both "f" and "g" will
be available. This is considered a feature, check reload's documentation:
http://docs.python.org/lib/built-in-funcs.html#l2h-59
|