Commit Graph

629 Commits

Author SHA1 Message Date
Dalai Felinto
b651f61278 bgl new methods (for glsl shaders - #version 120)
** I did not update rst docs. I will post on the quick-hack list. If no one volunteers to do it, I have it done before next release. **

this patch add the barebone functions to do glsl shaders in an addon.
For simplicity sakes it supports old GLSL, but not all the new modern methods (glBindFragDataLocation, ...).

It should be enough to make an addon to help with bge 2d filters.
I'm using this with a 3dview callback and it's working nicely:
self._handle = context.region.callback_add(draw_callback_px, (self, context), 'POST_VIEW')

I was considering not to commit this patch due to it not covering all OpenGL new methods.
But frankly it's not the first time bgl is expanded upon individual needs (guilty of that myself).
If a python developer knows enough to use OpenGL and need new functions, s/he should also be able to patch Blender for that,
so I see no problems here.

Another solution is to move to PyOpenGL or similar any soon. 

glShaderSource implemented differently than opengl standards. It's taking one source at a time (instead of an array of sources).
This is similar with PyOpenGL solution.

glActiveTexture
glAttachShader
glCompileShader
glCreateProgram
glCreateShader
glDeleteProgram
glDeleteShader
glDetachShader
glGetAttachedShaders
glGetProgramInfoLog
glGetProgramiv
glGetShaderInfoLog
glGetShaderiv
glGetShaderSource
glGetUniformLocation
glIsProgram
glIsShader
glLinkProgram
glShaderSource
glUniform1f
glUniform2f
glUniform3f
glUniform4f
glUniform1fv
glUniform2fv
glUniform3fv
glUniform4fv
glUniform1i
glUniform2i
glUniform3i
glUniform4i
glUniform1iv
glUniform2iv
glUniform3iv
glUniform4iv
glUniformMatrix2fv
glUniformMatrix3fv
glUniformMatrix4fv
glUniformMatrix2x3fv
glUniformMatrix3x2fv
glUniformMatrix2x4fv
glUniformMatrix4x2fv
glUniformMatrix3x4fv
glUniformMatrix4x3fv
glUseProgram
glValidateProgram
2012-05-09 02:42:30 +00:00
6520aa97a9 add 'idprop' module so we can document idprop.types.*, currently doc generator has no access to ID Property types. 2012-04-15 14:54:15 +00:00
85908b498b fix [#30906] dict(prop) crashes if prop is a PropertyGroup with nested PropertyGroup
the ID of a python ID property can be NULL.
2012-04-11 08:37:48 +00:00
c9e1ced4dd code cleanup: (dont include ';' in defines), last commit also missed changes to paint_image.c 2012-03-28 01:06:43 +00:00
11d12d945e style cleanup: python api 2012-03-26 06:55:09 +00:00
81d8f17843 style cleanup: pep8, indentation 2012-03-24 07:36:32 +00:00
5a90ea77bc style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:24:53 +00:00
b56d2f9766 fix [#30623] user-defined render presets bug
this report exposed multiple bugs in blender when using a non utf8 compatible home directory.

- bpy.utils.script_paths() would crash when homedir wasn't utf8 (reported bug)
- PyC_DefaultNameSpace() - would raise an error when running when __file__ was non utf8.
- preset filepath property was not set to accept non utf8.
- bpy.paths.display_name would raise an error on non utf8 paths, (used for preset draw)
2012-03-21 22:29:49 +00:00
4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
70d3d1aca6 style cleanup: py/capi 2012-03-16 21:39:56 +00:00
89a963fb7f style cleanup: comment blocks 2012-03-09 18:28:30 +00:00
4f7bdc59d3 style cleanup: spelling.
also remove large, duplicate comments from sunsky.h
2012-03-09 00:41:09 +00:00
27d43f3fd3 added API function to C and python
* C:  BM_vert_separate(...)
* py: bmesh.utils.vert_separate(vert, edges)

This splits off regions around the vertex, splitting on connected edges passed in a sequence.

also made minor changes
- rename python api functions _rip to _separate
- fixed bmesh iterator being iterable its self (some parts of python expect this)
- fix memory leak in bmesh python api.
2012-03-09 00:01:38 +00:00
1531e3677a bmesh py api
* add BLI_rfindlink for reverse index lookup (used so bm.select_history[-1] doesn't have to loop the entire list twice).
* add bm.select_history.active so you can get the last selected item or None without having to check seq length.
2012-03-03 22:07:58 +00:00
3590076193 style cleanup - comment formatting 2012-03-03 20:36:09 +00:00
74e9563b8a * bmesh py api BMEdge.verts was using 2 v1's
* bmesh pu api __repr__ functions for mesh data.
* correct py hash defines.
2012-02-26 17:20:36 +00:00
3fc2fbc333 style cleanup, use { on newline after function definition.
spelling 'impliment' -> 'implement'
2012-02-25 16:49:59 +00:00
3788adb8cb utility functions to convert between flags / sets, without depending on RNA API. 2012-02-22 09:15:46 +00:00
c4e7cc3287 fix for leak in gpu.export_shader(), wasnt freeing the function.
also change the bmesh iterator so its possible to initialize without stepping.
2012-02-20 22:04:29 +00:00
2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
4acab3eb33 Code Cleanup: line length and use Py_ssize_t for PyC_AsArray utility function. 2012-02-05 02:04:26 +00:00
51bada696f Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning
characters and 1 for zero-terminator). CustomData layers names are also
extended.
Changed DNA structures and all places where length constants were hardcoded.

All names which are "generating" from ID block should be limited by MAX_ID_NAME-2,
all non-id names now has got own define called MAX_NAME which should be used all
over for non-id names to make further name migration stuff easier.

All name fields in DNA now have comment with constant which corresponds to
hardcoded numeric value which should make it easier to further update this
limits or even switch to non-hardcoded values in DNA.

Special thanks to Campbell who helped figuring out some issues and helped a lot
in finding all cases where hardcoded valued were still used in code.

Both of forwards and backwards compatibility is stored with blender versions newer
than January 5, 2011. Older versions had issue with placing null-terminator to
DNA strings on file load which will lead to some unpredictable behavior or even
crashes.
2012-01-11 08:51:06 +00:00
e17fd46c71 formatting edits only to use more consisted style 2011-12-26 12:26:11 +00:00
b21a0f4fa1 formatting edits 120 line length 2011-12-24 02:37:42 +00:00
b59d8c6ba3 fix for own mistake [#29031] Importing BGL Can Crash the BGE and Blender
was adding the Buffer type to the module without increffing
2011-12-23 05:42:06 +00:00
9c9099a805 formatting edits in py api, no functional changes 2011-12-18 08:50:06 +00:00
53d14a78b5 missed removing these files 2011-11-29 10:34:23 +00:00
f95d7c9e66 patch [#29421] Python Noise Module Updates
from Andrew Hale (trumanblending)

Tracker description
*******************

The current python noise module included with Blender has yet to be updated to the new Py API. This patch does so, with the following major points:

- The noise module has now been moved to a submodule of mathutils, it can be accessed by mathutils.noise. It was moved from it's own module as it will now return mathutils types and also have greater visibility to the user.
- All functions which return vectors will now return mathutils.Vector types to be consistent with the rest of the API. Previously (x, y, z) tuples were returned.
- A different implementation of random_unit_vector is now used, this allows 2D, 3D and 4D vectors to be returned. Previously only 3D was possible.
- Some function names have been changed to remove ambiguities and make naming consistent within the module. noise.vector is now noise.noise_vector and noise.vl_vector is now noise.variable_lacunarity
- Doc strings have been updated to be compatible with auto docs.
- Code style and internal naming has been changed to match the conventions in other mathutils code.

Thanks,
Andrew
2011-11-29 10:28:52 +00:00
3db309ee50 fix for own error with id props when adding byte strings 2011-11-26 17:22:11 +00:00
676c2924d9 fix [#29319] bus error with python with link_append and {}
patch from Emil Brink
2011-11-22 14:05:08 +00:00
4924abaad6 replace fabs with fabsf where both input and output are floats. 2011-11-19 01:10:05 +00:00
4de917326b de-duplicate some idproperty py api code, also improve some exception messages. 2011-11-15 10:19:44 +00:00
d4d80ee0a1 rename IDProp.c/h to idprop_py_api, since it was same name as BKE idprop.c with case changed. 2011-11-15 09:28:15 +00:00
8623935aa8 pass a pointer to IDP_New's IDPropertyTemplate rather then a copy. 2011-11-15 09:22:52 +00:00
2ab1732613 support for non-null terminated byte strings in id properties (as a subtype of IDP_STRING types) 2011-11-15 09:12:10 +00:00
e84c0980a3 correct indentation and some whitespace edits (no functional changes) 2011-11-11 13:09:14 +00:00
e5647ea196 py operators - don't use the screen as an operators ID anymore, screen's don't store operator instances and operator functions have access to the context if they need the current screen.
also add some more py api file descriptions.
2011-11-05 08:40:07 +00:00
62f2218554 macro formatting & remve some unused code. 2011-11-05 05:44:52 +00:00
665f602f15 python string conversion
- use _PyUnicode_AsStringAndSize where possible
- use %R for PyErr_Format(...) rather then running repr on the object explicitly 
- use const char
2011-11-03 14:09:18 +00:00
9905094f5d fix own error r41191 getting id property string lengths. 2011-10-31 01:50:04 +00:00
699030ceb6 use const for readonly strings and set some functions to static 2011-10-27 14:41:26 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
ebe63b664b py api - added PyC_UnicodeFromByteAndSize() to match PyUnicode_FromStringAndSize()
also made RNA_property_string_get_alloc() return the length of the new string to avoid having to run strlen on it after.
2011-10-22 10:49:35 +00:00
8d6a554d75 - add BLI_string_utf8.h for unicode functions.
- move font.c unicode functions into string_utf8.c and rename to fit with other BLI_string funcs.
2011-10-20 09:47:05 +00:00
445279524a debug build option WITH_PYTHON_UI_INFO, so you can right click and edit the python source for UI layout directly. 2011-10-20 00:48:00 +00:00
276e5f7095 formatting edits & remove debug print. 2011-10-13 01:29:08 +00:00
21eb8b92a0 use newly added ID_BLEND_PATH() in more places. 2011-10-08 11:11:54 +00:00
018fa1540e whitespace edits, make formatting for functions consustent at least within the file. 2011-09-28 05:53:40 +00:00
928e2784c6 py api
- use Py_ssize_t when dealing with python sequence sizes
- dont call PySequence_Size(py_b) in a loop (its slow).
- use faster sequence/float parsing in aud.Factory.filter
2011-09-27 05:28:06 +00:00
d98bcb8a77 fix for py/rna api bug:
PyC_UnicodeAsByte(), used for getting python strings as bytes wasnt clearning utf-8 conversion errors.
  this would raise an error when getting an operators filepath.
2011-09-27 04:07:48 +00:00