Commit Graph

909 Commits

Author SHA1 Message Date
Daniel Stokes
e9e08a1d12 Game Engine: Level of detail support and tools
Levels of detail can be added and modified in the object panel. The object
panel also contains new tools for generating levels of detail, setting up
levels of detail based on object names (useful for importing), and
clearing an object's level of detail settings. This is meant as a game
engine feature, though the level of details settings can be previewed in
the viewport.

Reviewed By: moguri, nexyon, brecht

Differential Revision: http://developer.blender.org/D109
2013-12-17 17:03:27 -08:00
James Yonan
1831c930a5 Game Engine: Option to record static objects animation 2013-12-09 22:28:38 +11:00
Bastien Montagne
46eef60d93 Cleanup: Internal degrees removal.
This patch changes most of the reamining degrees usage in internal code into radians.
I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them.

WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly
         in previous versions (a few angle properties would use radians values as degrees...).

Details:
- Data:
-- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such
                  (using getter/setter functions), still using radians internally.
-- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev.

- Modifiers:
-- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done.

- Postprocessing:
-- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done.

- BGE:
-- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type,
                        it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence
                        can be either distance or angle values, depending on the mode. Will leave this to BGE team.
-- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself,
                                                                           as it seems this is the expected value here...).
-- bRadarSensor.angle: Done.

Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt

Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt
Thanks to all!

Differential Revision: http://developer.blender.org/D59
2013-12-03 20:35:45 +01:00
Sergey Sharybin
2b0162b622 Fix T37289: ID User decrement error for Shapes on Bones when playing in BGE
GE was copying the pose channels without increasing user counter for a
custom bone shape object. Freeing copied pose will for give decrement
errors.

The same increment issue seems to happen in BKE_pose_copy_data, which
is also solved now.
2013-11-18 17:19:15 +06:00
Mitchell Stokes
b90de0331d BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code.
This is a squashed commit of the following:
    BGE Physics Cleanup: Fix crashes with LibLoading and replication. Also fixing some memory leaks.
    BGE Physics Cleanup: Removing KX_IPhysicsController and KX_BulletPhysicsController.
    BGE Physics Cleanup: Moving the replication code outside of KX_BlenderBulletController and switching KX_ConvertPhysicsObjects to create a CcdPhysicsController instead of a KX_BlenderBulletController.
    BGE Physics Cleanup: Getting rid of an unsued KX_BulletPhysicsController.h include in KX_Scene.cpp.
    BGE Physics Cleanup: Removing unused KX_IPhysicsController and KX_BulletPhysicsController includes.
    BGE Physics Cleanup: Removing m_pPhysicsController1 and GetPhysicsController1() from KX_GameObject.
    BGE Physics Cleanup: Remove SetRigidBody() from KX_IPhysicsController and remove GetName() from CcdPhysicsController.
    BGE Physics Cleanup: Moving Add/RemoveCompoundChild() from KX_IPhysicsController to PHY_IPhysicsController.
    BGE Physics Cleanup: Removing GetLocalInertia() from KX_IPhysicsController.
    BGE Physics Cleanup: Making BlenderBulletCharacterController derive from PHY_ICharacter and removing CharacterWrapper from CcdPhysicsEnvironment.cpp. Also removing the character functions from KX_IPhysicsController.
    BGE Physics Cleanup: Removing GetOrientation(), SetOrientation(), SetPosition(), SetScaling(), and GetRadius() from KX_IPhysicsController.
    BGE Physics Cleanup: Removing GetReactionForce() since all implementations returned (0, 0, 0). The Python interface for KX_GameObject still has reaction force code, but it still also returns (0, 0, 0). This can probably be removed as well, but removing it can break scripts, so I'll leave it for now.
    BGE Physics Cleanup: Removing Get/SetLinVelocityMin() and Get/SetLinVelocityMax() from KX_IPhysicsController.
    BGE Physics Cleanup: Removing SetMargin(), RelativeTranslate(), and RelativeRotate() from KX_IPhysicsController.
    BGE Physics Cleanup: Using constant references for function arguments in PHY_IPhysicsController where appropriate.
    BGE Physics Cleanup: Removing ApplyImpulse() from KX_IPhysicsController.
    BGE Physics Cleanup: Removing ResolveCombinedVelocities() from KX_IPhysicsController.
    BGE Physics Cleanup: Accidently removed a return when cleaning up KX_GameObject::PyGetVelocity().
    BGE Physics Cleanup: Remove GetLinearVelocity(), GetAngularVelocity() and GetVelocity() from KX_IPhysicsController. The corresponding PHY_IPhysicsController functions now also take Moto types instead of scalars to match the KX_IPhysicsController interface.
    BGE Physics Cleanup: Moving SuspendDynamics, RestoreDynamics, SetMass, GetMass, and SetTransform from KX_IPhysicsController to PHY_IPhysicsController.
    BGE Physics Cleanup: PHY_IPhysicsEnvironment and derived classes now use the same naming scheme as PHY_IController.
    BGE Physics Cleanup: PHY_IMotionState and derived classes now use the same naming convention as PHY_IController.
    BGE Phsyics Cleanup: Making PHY_IController and its derived classes follow a consistent naming scheme for member functions. They now all start with capital letters (e.g., setWorldOrientation becomes SetWorldOrientation).
    BGE Physics Cleanup: Getting rid of KX_GameObject::SuspendDynamics() and KX_GameObject::RestoreDynamics(). Instead, use the functions from the physics controller.
    BGE: Some first steps in trying to cleanup the KX_IPhysicsController mess. KX_GameObject now has a GetPhysicsController() and a GetPhysicsController1(). The former returns a PHY_IPhysicsController* while the latter returns a KX_IPhysicsController. The goal is to get everything using GetPhysicsController() instead of GetPhysicsController1().
2013-11-04 19:22:47 +00:00
Mitchell Stokes
0cec5c63da BGE Rasterizer Cleanup: Removing the Singletexture material mode. More conversion code will probably be needed. 2013-11-04 19:21:50 +00:00
Mitchell Stokes
a565e34c39 BGE Rasterizer Cleanup: Removing KX_BlenderGL since it was mostly one-line functions used by KX_BlenderCanvas. KX_BlenderCanvas now just calls those functions directly. 2013-11-04 19:21:16 +00:00
Mitchell Stokes
cf9fe8f329 BGE Rasterizer Cleanup: Removing RAS_IRenderTools and moving the functionality to RAS_IRasterizer. RAS_OpenGLRasterizer is a bit of a mess now with references to Ketsji and other modules it shouldn't be accessing. 2013-11-04 19:21:07 +00:00
Sergej Reich
692693b92f Remove duplicate cmake enries in game engine and compositor 2013-10-25 11:00:16 +00:00
Campbell Barton
830974bc1e fix [#37032] Blener crashes when parent to new object 2013-10-10 20:56:27 +00:00
Campbell Barton
108a4c41c4 code cleanup: warnings and redundant checks. 2013-09-08 20:25:31 +00:00
Mitchell Stokes
eea0b16888 BGE: Removing an unused rendertools argument from BL_ConvertActuators(). 2013-09-05 04:19:05 +00:00
Mitchell Stokes
b9b806e0a0 BGE: Removing the touch sensor and converting all touch sensors to collision sensors. 2013-09-04 22:14:14 +00:00
Sergey Sharybin
9f7961b6b1 Optimization and threading fix for shapekeys weights calculation
This commit fixes two different issues, which were caused by
how weights are being calculated for relative shapekeys.

Weights for key block used to saved in KeyBlock DNA structure,
which lead to situations when different objects could start
writing to the same weights array if they're sharing the same
key datablock.

Solved this in a way so weights are never stored in KeyBlock
and being passed to shapekeys routines as an array of pointers.
This way weights are still computed run-time (meaning they're
calculated before shapekey evaluation and freed afterwards).

This required some changes to GameEngine as well, to make it
never cache weights in the key blocks.

Another aspect of this commit makes it so weight for a given
vertex group is only computed once. So if multiple key blocks
are using the same influence vertex group, they'll share the
same exact weights array. This gave around 1.7x speedup in
test chinchilla file which is close enough to if we've been
caching weights permanently in DNA (test machine is dual-code
4 threads laptop, speedup measured in depsgraph_mt branch,
trunk might be not so much high speedup).

Some further speed is optimization possible, but it could be
done later as well.

Thanks Brecht for idea of how the things might be solved in
really clear way.

--
svn merge -r58786:58787  ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:36:39 +00:00
Mitchell Stokes
196d30e004 BGE: The Action Actuator can now make use of additive blending. 2013-08-14 23:32:00 +00:00
Mitchell Stokes
9afae77fed BGE: Finally adding support for additive layer blending.
Currently this is only for the Python API. The logic brick will be updated in a future commit.
2013-08-14 23:31:49 +00:00
Campbell Barton
fdc336510a code cleanup: remove redundant NULL checks 2013-08-04 19:13:07 +00:00
Campbell Barton
7e697846a5 fix for BL_ArmatureConstraint::UpdateTarget(), was getting the pose from the target, not the subtarget. 2013-08-04 16:48:10 +00:00
Campbell Barton
93f5e2218a code cleanup: replace strncpy -> BLI_strncpy, skip first 2 chars when making a hash from the object name. 2013-08-04 03:45:30 +00:00
Daniel Stokes
a07ac7e644 BGE fix [#35563] Object colour setting for objects and fonts not using colour management like materials 2013-07-19 22:54:02 +00:00
Mitchell Stokes
eb21bdd249 Merging changes from trunk r58091-58323. 2013-07-17 01:40:26 +00:00
Mitchell Stokes
efc4b08094 BGE: Fix for [#36023] "Objects of added scene are lit by lights of current scene" reported by Raf Colson (raco).
The material caching now keeps a cache per scene. Before materials from different scenes were sharing the same cache.
2013-07-15 22:35:09 +00:00
Campbell Barton
02ba328ca8 clang/cmake - quiet warnings for external libs and reference moto as a system include. 2013-07-15 08:26:16 +00:00
Mitchell Stokes
83e9f32382 BGE: Committing patch #32422 "Debug properties for added objects" by HG1.
This patch allows debug properties from objects added to the scene at runtime to be displayed under the Debug Properties in the overhead display.
2013-07-09 20:06:36 +00:00
Daniel Stokes
d6f38e4e01 BGE: fix [#32775] LibFree crashing
Used the engine's RemoveScene (which ultimately calls the converter's RemoveScene) instead of the converter's RemoveScene when the converter free a blend file. This handles the scene removal in a safer fashion and solves the crash described in part 2 of the bug report. Part 1 no longer appears to cause a crash.
2013-06-21 06:56:43 +00:00
Daniel Stokes
62c6ee2c55 BGE: fix [#35447] LibLoad Meshes and Scenes causes crash of blender
KX_BlenderSceneConverter's destructor freed the contents of several std::vectors without removing those contents from the vectors. Later these vectors are iterated through. Making sure the vectors get cleared solves this problem.
2013-06-20 06:17:28 +00:00
Mitchell Stokes
4eded6dbdc BGE: Fix for [#35479] "OSKEY (Command Key on Mac) not working" reported by Mike Pan (mpan3).
The OSKEY was never added to the game engine, so it didn't recognize it.
2013-06-20 03:22:55 +00:00
Campbell Barton
9cf6e305a9 split bge includes for scons onto their own lines (for easier merging) 2013-05-29 21:56:55 +00:00
Sergey Sharybin
880c132b11 Fix #35480: object without material crash blender when starting game engine
Was a missing NULL-pointer check. No idea why it took so long to figure
issue out -- apparently there was no crash in linux for me and msvc
didn't show any backtrace :S

Also corrected weirdo way of bit flag check which was:
  !ma->mode & MA_FACETEXTURE
better do !(ma->mode & MA_FACETEXTURE) since ! is a logic NOT.
2013-05-27 15:13:14 +00:00
Campbell Barton
ec8d277c64 BLI_math rename functions:
- mult_m4_m4m4 -> mul_m4_m4m4
- mult_m3_m3m4 -> mul_m3_m3m4

these temporary names were used to avoid problems when argument order was switched.
2013-05-26 18:36:25 +00:00
Mitchell Stokes
76ee6d3fc5 BGE: Applying patch [#35416] "Missing python properties on ActionActuator: layer, layerWeight" from Florian Bantner (scheintodx). 2013-05-19 03:15:50 +00:00
Mitchell Stokes
18fda6d84c BGE: Fix for [#34044] "Objects with no material don't have their "face image" always working on bge" reported by Dalai Felinto (dfelinto).
NULL materials are no longer cached.
2013-05-11 03:20:19 +00:00
Mitchell Stokes
b0261a446d BGE: Fix for [#34631] "Textures bad in game mode" reported by pablo aaa (p9ablo).
Disabling caching if materials have Face Textures enabled.
2013-05-11 02:43:35 +00:00
Sergey Sharybin
0cd35ada0d Fix #35177: Press P Crashes Blender After Fracture of Cube
Root of the issue was fixed by Brecht in svn rev56441.
This change only prevents crash of files created in
blender before that fix, and also gives more useable
information about what's wrong (apparently, assert
here was doing nothing).
2013-05-02 09:45:00 +00:00
Campbell Barton
3f7f07faf5 style cleanup 2013-04-18 01:52:38 +00:00
Mitchell Stokes
8051ab07fc BGE: Cleaning up BL_ShapeDeformer's use of Blender's Key. This also fixes a bug with replicas (added objects) crashing when using shape keys. 2013-04-14 18:54:06 +00:00
Campbell Barton
64d161de87 style cleanup:
also rename mesh_getVertexCos() --> BKE_mesh_vertexCos_get() to match curve function.
2013-03-26 07:29:01 +00:00
Campbell Barton
e1a54214bb code cleanup:
- remove unused defines.
- quiet some shadow warnings.
- bevel, ifdef out some asserts that are too common.
- style
2013-03-25 02:41:30 +00:00
Campbell Barton
9379dcb507 code cleanup: unused defines, shadowing and unintended enum-as-variable. 2013-03-22 14:31:03 +00:00
Campbell Barton
dd0e2da784 code cleanup: use booleans and const's for operator vars. 2013-03-22 04:40:45 +00:00
Dalai Felinto
5ef9a20671 BGE bugfix for [#34505] Vertex Colors not working in the BGE (for custom GLSL shaders) when multitexture and no material
Bug introduced on rev.36723
2013-03-21 23:20:46 +00:00
Campbell Barton
f254ba77fd code cleanup: conversion from blender to BGE was unnecessarily confusing in checking weather to use vertex colors,
move check to function.
2013-03-21 23:11:52 +00:00
Dalai Felinto
6d8b3d2d94 BGE bugfix: [#34550] getVertexArrayLength changed in 2.66
This bug was producing way more geometry than we need. Potentially
memory saver (or performance even) bugfix.

Bottomline is:
We need to initialize the UVs otherwise vertex comparison fails ...
Ideally MoTo should take care of initializing MT_Point2
(note in Windows that seems to be fine, but it's safer to not rely on that)
2013-03-21 21:10:14 +00:00
Campbell Barton
655ed9cc7f style cleanup 2013-03-18 11:44:56 +00:00
Campbell Barton
09c41019a8 use const pointers for file loading and booleans for animation system return values passed as pointers. 2013-03-17 19:13:04 +00:00
Mitchell Stokes
db6d34daad BGE: Fix for bugs #34428, #20856, #20281. These were all multi-uv bugs caused by the BGE keeping too much uv information. When setting up shaders the BGE assumes each UV layer is unique, but the converter would store duplicates. 2013-03-02 18:05:52 +00:00
Campbell Barton
166de48ca4 code cleanup: confusingly written and named function for BGE materuial conversion: getImageFromMaterial() --> getMTexFromMaterial() 2013-02-23 07:36:40 +00:00
Campbell Barton
dddee08f27 code cleanup: bge material conversion was creating STR_String just to check for empty string for no reason (empty string was assigned irrespective). 2013-02-23 07:15:37 +00:00
Campbell Barton
e42e570ff4 BGE: fix for uninitialized tangents 2013-02-23 04:49:46 +00:00
Mitchell Stokes
87ab622463 BGE: Fix for bug #34377 "Multi UV mesh's materials not backwards compatible and Odd UV Coord behavior" reported by Alex Mairs (ctbm). The problem was the unused texture slot was still trying to be used. Now unused texture slots' mappings are set to DISABLE so they don't mess up the rest of the conversion process. 2013-02-23 04:15:47 +00:00