Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-07-03BGE: Extend Python API for KX_BlenderMaterial (specular, diffuse…)Porteries Tristan
Add support for material diffuse, specular… in KX_BlenderMaterial python proxy. And use mathutils in KX_BlenderMaterial for the specular and diffuse color in KX_BlenderMaterial. Reviewers: sybren, brita_, kupoman, agoose77, dfelinto, moguri, campbellbarton, hg1 Reviewed By: moguri, campbellbarton, hg1 Subscribers: dfelinto Projects: #game_engine Differential Revision: https://developer.blender.org/D1298
2015-03-24BGE: Add new world API KX_WorldInfo (KX_Scene)Thomas Szepe
This Patch will add a the world API (mist, background, ambient) to KX_WorldInfo. The new API uses now attributes. Reviewers: campbellbarton, moguri Reviewed By: moguri Subscribers: klauser, brecht Differential Revision: https://developer.blender.org/D157
2015-02-09Recreating bge python modules instead of using existingInes Almeida
All of the initXPythonBinding functions are changed to always creating the module instead of importing if previously existing. I can instead only remove the module return when the import is ok, so that it always inits. But then, I don't see the point in importing. I make sure that these functions are called only once per run, inside initBGE. This was not the case with GameTypes. I moved initPyTypes inside of initGameTypesPythonBinding due to that. I reorganized initGamePlayerPythonScripting and initGamePythonScripting so that they run things in the same order. initGamePlayerPythonScripting imports mathutils and aud, the other only aud. Shouldn't it be the same for both? Reviewers: campbellbarton Subscribers: sybren Projects: #game_engine, #game_python Differential Revision: https://developer.blender.org/D1070
2015-02-03BGE: python API cleanup - adding proper initialization to GameTypesInes Almeida
2014-06-26BGE: New Mouse ActuatorJorge Bernal
Disclaimer: The author of this patch is Geoffrey Gollmer (gomer). I only updated the patch to the current git master status, reworked several parts to fit well with current coding style and applied several fixes. This actuator allows users to show/hide the mouse cursor using logic bricks, as well as control object rotation with a mouse in the BGE. The mouse rotation is flexible enough to allow any type of mouse look, as well as banking for flight controls. {F94520} {F91859} Blend file for testing Mouse actuator (with default parameters and crosshair): {F94920} Reviewers: moguri Reviewed By: moguri CC: gomer, lordodin Differential Revision: https://developer.blender.org/D559
2013-11-04BGE Rasterizer Cleanup: Removing the Singletexture material mode. More ↵Mitchell Stokes
conversion code will probably be needed.
2013-08-10As requested by Mitchell Stokes, reverting r58837 as it is causing some ↵Daniel Stokes
problems with the embedded game engine's python execution.
2013-08-03BGE: Fixing a memory leak with PyType_Ready_ADD.Mitchell Stokes
2013-03-17code cleanup: add 'const' to headers to quiet msvc warnings, also remove ↵Campbell Barton
(char *) casts that aren't needed now we're on Python3.3
2012-12-22BGE: Committing async LibLoad from Swiss. This does the lib loading in a ↵Mitchell Stokes
separate thread to keep the BGE from freezing. Here is an example from the docs: # Print a message when an async LibLoad is done import bge def finished_cb(status): print("Library (%s) loaded in %.2fms." % (status.libraryName, status.timeTaken)) bge.logic.LibLoad('myblend.blend', 'Scene', async=True).onFinish = finished_cb LibLoad() now returns a KX_LibLoadStatus object for information on the library loading. LibNew() and LibFree() are unaffected by this commit. In other words, the async option only works for LibLoad(). Furthermore it only works for Scenes, not Actions or Meshes.
2012-12-21BGE: Adding a Python interface for handling joysticks without needing logic ↵Mitchell Stokes
bricks. These new SCA_PythonJoystick objects can be accessed using bge.logic.joysticks, which is a list of joysticks. The length of the list is the number of maximum supported joysticks, and indexes that do not have a joystick available are set to None. This means joysticks can be checked for using something like: if bge.logic.joysticks[0]: activate_player_one() if bge.logic.joysticks[1]: activate_player_two() etc.. The interface exposed by SCA_PythonJoystick is very similar to the joystick logic brick except for one key difference: axis values are normalized to a -1.0 to 1.0 range instead of -32767 to 32767, which is what the logic brick exposed.
2012-11-22BGE: KX_PhysicsObjectWrapper was not being used anywhere in the code base, ↵Mitchell Stokes
but it was being maintained (style, docs, name changes, etc), so I'm removing it.
2012-11-21doc corrections and add bge.types.KX_ArmatureSensorCampbell Barton
2012-11-05BGE: This patch adds a character wrapper (similar to the already implemented ↵Mitchell Stokes
vehicle wrapper) to control character physics options. Currently supported options are: * jump() -- causes the character to jump * onGround -- specifies whether or not the character is on the ground * gravity -- controls the "gravity" that the character physics uses for the character More options could be added (such as jump speed, step height, make fall speed, max slope, etc).
2012-09-16fix for error in recent commit (made function static that shouldn't have ↵Campbell Barton
been), add extra gcc warnings to cmake.
2012-09-16code cleanup: make local game engine functions staticCampbell Barton
2012-03-28style cleanupCampbell Barton
2012-03-24style cleanup: follow style guide for/with/if spacingCampbell Barton
2012-03-09style cleanup: comment blocksCampbell Barton
2011-10-23remove $Id: tags after discussion on the mailign list: ↵Campbell Barton
http://markmail.org/message/fp7ozcywxum3ar7n
2011-05-17synched with trunk at revision 36569Nick Samarin
2011-02-25doxygen: gameengine/Ketsji tagged.Nathan Letwory
2011-02-23doxygen: prevent GPL license block from being parsed as doxygen comment.Nathan Letwory
2011-02-16synched with trunk at revision 34793Nick Samarin
2010-12-16Patch:[#25163] BGE support for Blender Font objects - unicode supportDalai Felinto
Problem/Bug: ------------ There were no way to have proper unicode characters (e.g. Japanese) in Blender Game Engine. Now we can :) You can see a sample here: http://blog.mikepan.com/multi-language-support-in-blender/ Functionality Explanation: -------------------------- This patch converts the Blender Font Objects to a new BGE type: KX_FontObject This object inherits KX_GameObject.cpp and has the following properties: - text (the text of the object) - size (taken from the Blender object, usually is 1.0) - resolution (1.0 by default, maybe not really needed, but at least for debugging/the time being it's nice to have) The way we deal with linked objects is different than Blender. In Blender the text and size are a property of the Text databock. Therefore linked objects necessarily share the same text (and size, although the size of the object datablock affects that too). In BGE they are stored and accessed per object. Without that it would be problematic to have addObject adding texts that don't share the same data. Known problems/limitations/ToDo: -------------------------------- 1) support for packed font and the <builtin> 2) figure why some fonts are displayed in a different size in 3DView/BGE (BLF) 3) investigate some glitches I see some times 4) support for multiline 5) support for more Blender Font Object options (text aligment, text boxes, ...) [1] Diego (bdiego) evantually will help on that. For the time being we are using the "default" (ui) font to replace the <builtin>. [2] but not all of them. I need to cross check who is calculating the size/dpi in/correctly - Blender or BLF. (e.g. fonts that work well - MS Gothic) [3] I think this may be related to the resolution we are drawing the font [4] It can't/will not be handled inside BFL. So the way I see it is to implement a mini text library/api that works as a middlelayer between the drawing step and BLF. So instead of: BLF_draw(fontid, (char *)text, strlen(text)); We would do: MAGIC_ROUTINE_IM_NOT_BLF_draw(fontir, (char *)text, styleflag, width, height); [5] don't hold your breath ... but if someone wants to have fun in the holidays the (4) and (5) are part of the same problem. Code Explanation: ----------------- The patch should be simple to read. They are three may parts: 1) BL_BlenderDataConversion.cpp:: converts the OB_FONT object into a KX_FontObject.cpp and store it in the KX_Scene->m_fonts 2) KetsjiEngine.cpp::RenderFonts:: loop through the texts and call their internal drawing routine. 3) KX_FontObject.cpp:: a) constructor: load the font of the object, and store other values. b) DrawText: calculate the aspect for the given size (sounds hacky but this is how blf works) and call the render routine in RenderTools 4) KX_BlenderGL.cpp (called from rendertools) ::BL_print_game_line:: Draws the text. Using the BLF API *) In order to handle visibility of the object added with AddObject I'm adding to the m_scene.m_fonts list only the Fonts in a visible layer - unlike Cameras and Lamps where all the objects are added. Acknowledgements: ---------------- Thanks Benoit for the review and adjustment suggestions. Thanks Diego for the BFL expertise, patches and support (Latin community ftw) Thanks my boss for letting me do part of this patch during work time. Good thing we are starting a project in a partnership with a Japanese Foundation and eventual will need unicode in BGE :) for more details on that - www.nereusprogram.org - let's call it the main sponsor of this "bug feature" ;)
2010-10-31rename and negate DISABLE_PYTHON --> WITH_PYTHONCampbell Barton
2010-07-21- added custom get function for navmesh property of steering actuator to ↵Nick Samarin
accept only objects with NavMesh physics type - fixed the access to KX_SteeringActuator attributes from scripts - added enum members for KX_SteeringActuator and KX_NavMeshObject to GameLogic dictionary
2010-06-01Added new actuator type for following steering behaviors: seek, flee, path ↵Nick Samarin
following; renamed KX_Pathfinder to KX_NavMeshObject
2010-05-28- added new game object type for navigation meshNick Samarin
- added py api for path finding and ray casting - set svn properties for KX_Pathfinder
2010-04-17Patch #21789 - BGE Keyboard and Mouse Python types - by Mitchell Stokes(Moguri)Dalai Felinto
The patch exposes mouse and keyboard read-only properties in the GameLogic module Also renames bge.keys to bge.events (* Note: name of bge submodules (logic, render, ...) may change before 2.5 final release [right Campbell?]). """ This patch adds two new types to the BGE: SCA_PythonKeyboard SCA_PythonMouse These two types allow users to make use of the keyboard and mouse without the need for a keyboard or mouse sensor. SCA_PythonKeyboard has an events property that acts just like SCA_KeyboardSensor.events. SCA_PythonMouse also has an events property to check for mouse events. Further more it supports getting and setting normalized cursor position (from 0.0 to 1.0) with SCA_PythonMouse.position. The cursor can be shown/hidden using SCA_PythonMouse.visible. """ Its use is similar with current mouse and keyboard controllers. With the exception of mouse position being normalized and writable as well (replacing Rasterizer.setMousePosition). Code Sample: ###### from bge import logic, events mouse = logic.mouse keyboard = logic.keyboard for key,status in keyboard.events: if status == logic.KX_INPUT_JUST_ACTIVATED: if key == events.WKEY: print(mouse.position) # move_forward() mouse.visible = True # turn cursor visible mouse.position = 0.5,0.5 # centralize mouse - use tuple ###### * Important Note: mouse.position still will not work properly for Letterbox mode. In order to fix letterboxing I may need to move the set x,y mouse function to inside the canvas code (to avoid duplicated code between mouse sensor and bge.logic.mouse). I'll leave this for another commit though. Thanks Mitchell for the work on that.
2010-02-12correct fsf addressCampbell Barton
2009-09-30option to build the BGE without python, uses existing python check (cmake ↵Campbell Barton
and scons) when python is disabled videotextures are not built.
2009-09-25Merge of itasc branch. Project files, scons and cmake should be working. ↵Benoit Bolsee
Makefile updated but not tested. Comes with Eigen2 2.0.6 C++ matrix library.
2009-08-19- fix for BGE warningsCampbell Barton
- when C++ uses guardedalloc SYS_DeleteSystem was called after MEM_printmemlist(), making it look like there was a leak.
2009-08-102.5 audio cleanup:Joerg Mueller
* Removed CD Actuator * Removed bSample and bSoundListener * Removed SoundSystem * Removed -noaudio parameter
2009-06-29BGE PyAPI support for subclassing any BGE game type from python, scripters ↵Campbell Barton
define extra functions on gameObjects. Adding a UI to set the type on startup can be added easily. # ---- class myPlayer(GameTypes.KX_GameObject): def die(self): # ... do stuff ... self.endObject() # make an instance player = myPlayer(gameOb) # gameOb is made invalid now. player.die() # ---- One limitation (which could also be an advantage), is making the subclass instance will return that subclass everywhere, you cant have 2 different subclasses of the same BGE data at once.
2009-06-28BGE Python APICampbell Barton
Remove the last of the odd C++/python wrapper code from http://www.python.org/doc/PyCPP.html (~1998) * Use python subclasses rather then having fake subclassing through get/set attributes calling parent types. * PyObject getset arrays are created while initializing the types, converted from our own attribute arrays. This way python deals with subclasses and we dont have to define getattro or setattro functions for each type. * GameObjects and Scenes no longer have attribute access to properties. only dictionary style access - ob['prop'] * remove each class's get/set/dir functions. * remove isA() methods, can use PyObject_TypeCheck() in C and issubclass() in python. * remove Parents[] array for each C++ class, was only used for isA() and wasnt correct in quite a few cases. * remove PyTypeObject that was being passed as the last argument to each class (the parent classes too). TODO - * Light and VertexProxy need to be converted to using attributes. * memory for getset arrays is never freed, not that bad since its will only allocates once.
2009-06-25PyAPI RNA/BGECampbell Barton
* all mathutils types now have optional callbacks * PyRNA returns mathutils quat and euler types automatically when they have the rotation subtype. * PyRNA, reuse the BPy_StructRNA PyObject rather name making a new one for each function returned. * use more arithb.c functions for Mathutils quaternion type (less inline cruft). * BGE Mathutils integration mostly finished- KX_PyMath now converts to Mathutils types rather then lists. * make all mathutils types share the same header so they can share a number of functions - dealloc, getWrapped, getOwner.
2009-06-22PyAPI Mathutils Vector callbacks, referencing other PyObjects rather then ↵Campbell Barton
thin wrapping vectors which is crash prone. in short, vectors can work as if they are thin wrapped but not crash blender if the original data is removed. * RNA vector's return Mathutils vector types. * BGE vectors for GameObject's localPosition, worldPosition, localPosition, localScale, worldScale, localInertia. * Comment USE_MATHUTILS define to disable returning vectors. Example... * 2.49... * loc = gameOb.worldPosition loc[1] = 0 gameOb.worldPosition = loc * With vectors... * gameOb.worldPosition[1] = 0 * But this wont crash... * loc = gameOb.worldPosition gameOb.endObject() loc[1] = 0 # will raise an error that the objects removed. This breaks games which assume return values are lists. Will add this to eulers, matrix and quaternion types later.
2009-06-092.50:Brecht Van Lommel
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD Notes: * Game and sequencer RNA, and sequencer header are now out of date a bit after changes in trunk. * I didn't know how to port these bugfixes, most likely they are not needed anymore. * Fix "duplicate strip" always increase the user count for ipo. * IPO pinning on sequencer strips was lost during Undo.
2009-04-202.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender ↵Brecht Van Lommel
-r19323:HEAD Notes: * blenderbuttons and ICON_SNAP_PEEL_OBJECT were not merged.
2009-04-19BGE Python APICampbell Barton
removed redundant (PyObject *self) argument from python functions that are not exposed to python directly.
2009-04-19BGE Python APICampbell Barton
This changes how the BGE classes and Python work together, which hasnt changed since blender went opensource. The main difference is PyObjectPlus - the base class for most game engine classes, no longer inherit from PyObject, and cannot be cast to a PyObject. This has the advantage that the BGE does not have to keep 2 reference counts valid for C++ and Python. Previously C++ classes would never be freed while python held a reference, however this reference could be problematic eg: a GameObject that isnt in a scene anymore should not be used by python, doing so could even crash blender in some cases. Instead PyObjectPlus has a member "PyObject *m_proxy" which is lazily initialized when python needs it. m_proxy reference counts are managed by python, though it should never be freed while the C++ class exists since it holds a reference to avoid making and freeing it all the time. When the C++ class is free'd it sets the m_proxy reference to NULL, If python accesses this variable it will raise a RuntimeError, (check the isValid attribute to see if its valid without raising an error). - This replaces the m_zombie bool and IsZombie() tests added recently. In python return values that used to be.. return value->AddRef(); Are now return value->GetProxy(); or... return value->NewProxy(true); // true means python owns this C++ value which will be deleted when the PyObject is freed
2009-04-13SVN maintenance.Guillermo S. Romero
2009-04-07BGE Python APICampbell Barton
Use each types dictionary to store attributes PyAttributeDef's so it uses pythons hash lookup (which it was already doing for methods) rather then doing a string lookup on the array each time. This also means attributes can be found in the type without having to do a dir() on the instance.
2009-04-07error in last commitCampbell Barton
2009-04-06BGE Python APICampbell Barton
- added a module for the BGE - GameTypes, only contains types. - added KX_PYATTRIBUTE_DUMMY attributes for KX_Light, KX_PolyProxy, KX_VertexProxy, so all types should give correct results from a dir(). - added a script to check for missing methods in the epydocs - bge_api_validate_py.txt
2009-04-05BGE Bugfixes (mostly in the py api)Campbell Barton
KX_PolygonMaterial and KX_BlenderMaterial - Added a print function (would raise a python error on printing) * Crashes * KX_GameObject SetParent - Disallowed setting a parent to its self, caused a recursion crash. KX_MeshProxy "materials" attribute was segfaulting because of my recent change - I was wrong, you do need to check material types (no idea why since they are both PyObject * at the base) KX_VisibilityActuator - Wasn't initialized with PyType_Ready() making it crash on access (own fault) * Crashes because of missing NULL checks * KX_PolygonMaterial's "gl_texture" attribute wasnt checking for a valid m_tface KX_GameObject - added checks for GetPhysicsController() KX_RayCast::RayTest - didnt check for a valid physics_environment KX_SceneActuator's getCamera python function wasnt checking if there was a camera.
2009-04-03Python BGE APICampbell Barton
- Initialize python types with PyType_Ready, which adds methods to the type dictionary. - use Pythons get/setattro (uses a python string for the attribute rather then char*). Using basic C strings seems nice but internally python converts them to python strings and discards them for most functions that accept char arrays. - Method lookups use the PyTypes dictionary (should be faster then Py_FindMethod) - Renamed __getattr -> py_base_getattro, _getattr -> py_getattro, __repr -> py_base_repr, py_delattro, py_getattro_self etc. From here is possible to put all the parent classes methods into each python types dictionary to avoid nested lookups (api has 4 levels of lookups in some places), tested this but its not ready yet. Simple tests for getting a method within a loop show this to be between 0.5 and 3.2x faster then using Py_FindMethod()