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
2009-05-10deprecate controller.getActuator(name) and controller.getSensor(name) forCampbell Barton
controller.actuators[name] and controller.sensors[name] Made a read-only sequence type for logic brick sensors and actuators which can access single items or be used like a list or dictionary. We could use a python dictionary or CValueList but that would be slower to create. So you can do... for s in controller.sensors: print s print controller.sensors["Sensor"] print controller.sensors[0] sensors = list(controller.sensors) This sequence type keeps a reference to the proxy it came from and will raise an error on access if the proxy has been removed.
2009-05-06moved py controller functions from SCA_PythonController to SCA_IController - ↵Campbell Barton
the base controller class so python can get the sensors & actuators from any controller (not just SCA_PythonController types) also deprecated getActuators() and getSensors() for 'sensors' and 'actuators' attributes. an example of getting every sensor connected to an object. all_sensors = [s for c in ob.controllers for s in c.sensors]
2009-05-05Disable importing module python controller scripts at conversion time ↵Campbell Barton
because it can run BGE functions and crash since the internal state isnt setup yet. face-select mode wasnt working when used with projection paint.
2009-05-05BGE logic: new sensor "tap" option to generate automatically on/off pulsesBenoit Bolsee
When enabled, this option converts any positive trigger from the sensor into a pair of positive+negative trigger, with the negative trigger sent in the next frame. The negative trigger from the sensor are not passed to the controller as the option automatically generates the negative triggers. From the controller point of view, the sensor is positive only for 1 frame, even if the underlying sensor state remains positive. The option interacts with the other sensor option in this way: - Level option: tap option is mutually exclusive with level option. Both cannot be enabled at the same time. - Invert option: tap option operates on the negative trigger of the sensor, which are converted to positive trigger by the invert option. Hence, the controller will see the sensor positive for 1 frame when the underlying sensor state turns negative. - Positive pulse option: tap option adds a negative trigger after each repeated positive pulse, unless the frequency option is 0, in which case positive pulse are generated on every frame as before, as long as the underlying sensor state is positive. - Negative pulse option: this option is not compatible with tap option and is ignored when tap option is enabled. Notes: - Keyboard "All keys" is handled specially when tap option is set: There will be one pair of positive/negative trigger for each new key press, regardless on how many keys are already pressed and there is no trigger when keys are released, regardless if keys are still pressed. In case two keys are pressed in succesive frames, there will be 2 positive triggers and 1 negative trigger in the following frame.
2009-05-04BGE performance: use inline function as much as possible in scenegraph and ↵Benoit Bolsee
logic to avoid function call.
2009-05-04BGE: fix a crash with previous scene destruction speed up commit when ↵Benoit Bolsee
sensors and controllers are cross connected between objects.
2009-05-03fixes for bugs submitted by BGE users, fixes by myself and Mitchell StokesCampbell Barton
- when the attribute check function failed it didnt set an error raising a SystemError instead - Rasterizer.getMaterialMode would never return KX_BLENDER_MULTITEX_MATERIAL - PropertySensor value attribute checking function was always returning a fail. - Vertex Self Shadow python script didnt update for meshes with modifiers.
2009-05-02BGE PyController module type.Campbell Barton
- Added support for any number of attributes, this means packages are supported automatically. so as well as "myModule.myFunc" you can do "myPackage.myModule.myFunc", nested packages work too. - pass the controller to the python function as an argument for functions that take 1 arg, this check is only done at startup so it wont slow things down. added support for
2009-05-02BGE Py API patch from Mitchell Stokes, adds extra attributes and docsCampbell Barton
2009-05-02BGE performance:Benoit Bolsee
- Vast performance increase when removing scene containing large number of objects: the sensor/controller map was updated for each deleted object, causing massive slow down when the number of objects was large (O(n^2)). - Use reference when scanning the sensor map => avoid useless copy. - Remove dynamically the object bounding box from the DBVT when the object is invisible => faster culling.
2009-04-30Not sure why this INCREF is needed since making a replica wont use the ↵Campbell Barton
m_bytecode so why should it add a user? Removed in 19974 but that crashes YoFrankie so adding back in for now.
2009-04-29ifdef's for future py3 support, after this adding py3 can mostly be done ↵Campbell Barton
with defines or batch renaming funcs (with the exception of CListValue slicing) . No changes for py2.x.
2009-04-29attempt to fix for py2.3Campbell Barton
2009-04-29BGE alternative run mode for python controllers.Campbell Barton
Option to run a function in a module rather then a script from a python controller, this has a number of advantages. - No allocating and freeing the namespace dictionary for every time its triggered (hard to measure the overhead here, but in a test with calling 42240 scripts a second each defining 200 vars, using modules was ~25% faster) - Ability to use external python scripts for game logic. - Convenient debug option that lets you edit scripts while the game engine runs.
2009-04-23patch from Mitchell Stokes, comments only - KX_PYATTRIBUTE_TODO for missing ↵Campbell Barton
attributes
2009-04-22BGE: some more cleanup, remove useless ReplicaSetName(), move code to ↵Benoit Bolsee
ProcessReplica.
2009-04-22BGE C++ APICampbell Barton
PyObjectPlus::ProcessReplica() is now called when any of its subclasses are replicated. This is important because PyObjectPlus::ProcessReplica() NULL's the 'm_proxy' python pointer I added recently. Without this a replicated subclass of PyObjectPlus could have an invalid pointer (crashing the BGE). This change also means CValue::AddDataToReplica() can be moved into CValue::ProcessReplica() since ProcessReplica is always called.
2009-04-22Patch from Mitchell Stokes for KX_Light to use attrdef'sCampbell Barton
Added type access to the SCA_PropertyActuator, added missing function in library docs.
2009-04-21use PyList_SET_ITEM instead of PyList_SetItem,Campbell Barton
PyList_SetItem does error checking and decref's existing values, PyList_SET_ITEM is a macro for direct assignment, only for use on new lists.
2009-04-21BGE Python APICampbell Barton
Separate getting a normal attribute and getting __dict__, was having to do too a check for __dict__ on each class (multiple times per getattro call from python) when its not used that often.
2009-04-20BGE Python APICampbell Barton
- initialize pythons sys.argv in the blenderplayer - ignore all arguments after a single " - " in the blenderplayer (like in blender), so args can be passed to the game. - add a utility function PyOrientationTo() - to take a Py euler, quat or 3x3 matrix and convert into a C++ MT_Matrix3x3. - add utility function ConvertPythonToMesh to get a RAS_MeshObject from a KX_MeshProxy or a name. - Added error prefix arguments to ConvertPythonToGameObject, ConvertPythonToMesh and PyOrientationTo so the error messages can include what function they came from. - deprecated brick.getOwner() for the "owner" attribute.
2009-04-20BGE Python APICampbell Barton
- More verbose error messages. - BL_Shader wasnt setting error messages on some errors - FilterNormal depth attribute was checking for float which is bad because scripts often expect ints assigned to float attributes. - Added a check to PyVecTo for a tuple rather then always using a generic python sequence. On my system this is over 2x faster with an optmized build.
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 API cleanup - no functionality changesCampbell Barton
- comments to PyObjectPlus.h - remove unused/commented junk. - renamed PyDestructor to py_base_dealloc for consistency - all the PyTypeObject's were still using the sizeof() their class, can use sizeof(PyObjectPlus_Proxy) now which is smaller too.
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-18Added m_zombie to the base python class (PyObjectPlus), when this is set all ↵Campbell Barton
the subclasses will raise an error on access to their members. Other small changes... - KX_Camera and KX_Light didnt have get/setitem access in their PyType definition. - CList.from_id() error checking for a long was checking for -1 against an unsigned value (own fault) - CValue::SpecialRelease was incrementing an int for no reason. - renamed m_attrlist to m_attr_dict since its a PyDict type. - removed custom getattro/setattro functions for KX_Scene and KX_GameObject, use py_base_getattro, py_base_setattro for all subclasses of PyObjectPlus. - lowercase windows.h in VideoBase.cpp for cross compiling.
2009-04-17Missing <stdlib.h> for abs() made this file not compile for me.Ton Roosendaal
2009-04-15Fix for own recent reference count error.Campbell Barton
- The armature weakref list was being incref'd twice then decrefed twice (incref and decref were used incorrectly), now only once. My 'fix' broke this. - In bpy_pydriver_create_dict the 2 refs added from running PyDict_SetItemString twice were undone when clearing the dictionary (added comment) - changed Py_XDECREF to Py_DECREF int BPY_pyconstraint_update and BPY_pyconstraint_target, Py_XDECREF checs for NULL value which would have crashed blender before it got to Py_XDECREF anyway. - after every error is reported (PyErr_Print), remove sys.last_traceback and clear the error, I found this fixed certain crashes (usually when starting the game engine or exiting blender), so best do this all the time. - header_text.c, CcdPhysicsEnvironment.cpp, KX_CameraActuator.cpp - remove some warnings.
2009-04-12PropertyActuator toggle option didnt run when the Value field was empty.Campbell Barton
2009-04-12added "toggle" an option for the property actuator.Campbell Barton
much less hassle then setting up a property sensor and 2 assignment actuators, or through python.
2009-04-12use long long rather then int for storing game logic properties.Campbell Barton
There were also some problems with int to python conversion - assigning a PyLong to a KX_GameObject from python would raise an error - PyLong were coerced into floats when used with internal CValue arithmetic Changes... - PyLong is converted into CIntValue for coercing and assigning from python - CValue's generic GetNumber() function returns a double rather then a float. - Print an error when a PyType cant be coerced into a CValue Tested with python, expressions and property sensor.
2009-04-10Added function name to many of the PyArg_ParseTuple calls in gameengineAndre Susano Pinto
This way python raises more useful messages.
2009-04-10BGE BugfixCampbell Barton
The End key didn't work work at all for the keyboard sensor. Removed getEventList() since it was added since 2.48a release.
2009-04-09Added GameKeys.EventToCharacter(event, is_shift) so you can get the ↵Campbell Barton
character that would be types when pressing a key. Last commit was made in the pydocs folder only, so this includes changes mentioned in rev 19620.
2009-04-09key logging didnt work for alphanum keys -=_+ and |\ since revision 2 and ↵Campbell Barton
nobody noticed!
2009-04-09BGE TextCampbell Barton
- multi-line strings for bitmap text - keyboard sensor now logs return and pad enter as "\n" BGE std::vector use in Value.cpp and RAS_MaterialBucket.cpp The size of a new list is known before making them, reduce re-allocs, though probably not a noticeable speedup.
2009-04-09BGE API cleanup: 2DFilterActuator.Benoit Bolsee
2009-04-07Some users have odd joysticks with more then 8 axises, increased to 16 (so 4 ↵Campbell Barton
joysticks) Ideally there would be no limit but I dont think its worth the effort. Also had a bug in last commit for the pytyhon api's "axisSingle" attribute, UI index starts at 1 not zero.
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-07BGE Joystick SensorCampbell Barton
- Raised limit of 2 axis to 4 axis pairs (4==8 joysticks axis pairs) - Added a new Joystick Sensor type "Single Axis", so you can detect horizontal or vertical movement, rather then just Up/Down/Left/Right - added Python attribute "axisSingle" so you can get the value from the selected axis (rather then getting it out of the axis list) - renamed Py attribute "axisPosition" to "axisValues" (was never in a release) If we need to increase the axis limit again just change JOYAXIS_MAX and the button limits.
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-04moved more attributes from getattr into PyAttributeDef'sCampbell Barton
2009-04-03BGE API cleanup: RandomActuator.Benoit Bolsee
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()
2009-04-03BGE Python apiCampbell Barton
Added the method into the PyType so python knows about the methods (its supposed to work this way). This means in the future the api can use PyType_Ready() to store the methods in the types dictionary. Python3 removes Py_FindMethod and we should not be using it anyway since its not that efficient.
2009-03-16BGENathan Letwory
* getting state of RMB was impossible due to wrong check.
2009-03-12BGE patch 18368: Modulus (ie %) expression controller in BGE. Implement a ↵Benoit Bolsee
cache for the expression for better performance.
2009-02-26Py BGE APICampbell Barton
Python dir(ob) for game types now includes attributes names, * Use "__dict__" rather then "__methods__" attribute to be Python 3.0 compatible * Added _getattr_dict() for getting the method and attribute names from a PyObject, rather then building it in the macro. * Added place holder *::Attribute array, needed for the _getattr_up macro.
2009-02-25remove warnings for the BGECampbell Barton
- variables that shadow vers declared earlier - Py_Fatal print an error to the stderr - gcc was complaining about the order of initialized vars (for classes) - const return values for ints and bools didnt do anything. - braces for ambiguous if statements
2009-02-24BGE Py APICampbell Barton
* Made GameLogic.addActiveActuator(actu, bool) to raise an error if the actuator is not in the list. Before it would allow any value as the actuator and fail silently (makes debugging scripts more difficult). * Allow the actuator to be a string which is convenient if you dont want to change the settings of the actuator. * Added activate/deactivate functions to the controller, this is more logical since the GameLogic.addActiveActuator() function is running through the controller anyway. GameLogic.addActiveActuator(controller.getActuator("SomeAct"), True) ...can be replaced with... controller.activate("SomeAct")