Page MenuHome

BGE : Cleanup camera and font list
AbandonedPublic

Authored by Porteries Tristan (panzergame) on Feb 28 2015, 11:21 PM.

Details

Summary

I replaced std::list used for cameras and fonts by CListValue, so i removed AddFCamera, FindCamera, AddFont, FindFont functions.
I took advantage of CListValue and add a python attribute for fonts :

KX_Scene.fonts

Diff Detail

Repository
rB Blender
Branch
ge_cleanup_camera_font_list

Event Timeline

What problem does this solve?

It's just a cleanup for devs, all other listes in scene use CListValue i think cameras and fonts don't need to use a std::list there are no advantages.

Replace i by cam_idx in loop.

Sybren A. Stüvel (sybren) edited edge metadata.

Looks good to me. Some things became more complex (scene->FindCamera(name) became (KX_Camera*)scene->GetCameraList()->FindValue(name)) but I feel that the improvement in consistency is worth it.

This revision is now accepted and ready to land.Mar 13 2015, 8:41 PM
Porteries Tristan (panzergame) edited edge metadata.

Update to the current trunk.

Jorge Bernal (lordloki) requested changes to this revision.Apr 5 2015, 2:32 AM
Jorge Bernal (lordloki) edited edge metadata.

Only I miss the doc for new fonts attribute (bge_types/bge.types.KX_Scene.rst).

Other than this, looks good to me.

This revision now requires changes to proceed.Apr 5 2015, 2:32 AM
Porteries Tristan (panzergame) edited edge metadata.

Add documentation and fix mouse sensor

Jorge Bernal (lordloki) edited edge metadata.
This revision is now accepted and ready to land.Apr 6 2015, 6:37 AM
Mitchell Stokes (moguri) requested changes to this revision.Apr 6 2015, 9:15 PM
Mitchell Stokes (moguri) edited edge metadata.

I'm not yet sure if I like these changes, so I'm blocking this revision until I can find time to look over it in detail.

This revision now requires changes to proceed.Apr 6 2015, 9:15 PM
Campbell Barton (campbellbarton) requested changes to this revision.Jun 20 2015, 11:59 AM
Campbell Barton (campbellbarton) edited edge metadata.

Python can edit CListValue's, but your patch doesn't mention this... which is concerning.
The ability for Python to manipulate internal state is not something to allow without some consideration.

source/gameengine/Ketsji/KX_Scene.cpp
2424

calling fonts is odd, this is really text objects, should call texts ?

Porteries Tristan (panzergame) edited edge metadata.

Update to current trunk, rename "fonts" to "texts"

Python can edit CListValue's, but your patch doesn't mention this... which is concerning.

There is no case of a CListValue owned by python at the moment. (other than scene.cameras, but it disallowed now)