Skip to content

Commit

Permalink
UPBGE: Renaming KX_MeshProxy to KX_Mesh and make it permanent.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Dec 23, 2017
1 parent a3957d7 commit 92af8d6
Show file tree
Hide file tree
Showing 37 changed files with 224 additions and 260 deletions.
2 changes: 1 addition & 1 deletion doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ base class --- :class:`SCA_IObject`

a list meshes for this object.

:type: list of :class:`KX_MeshProxy`
:type: list of :class:`KX_Mesh`

.. note::

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
KX_MeshProxy(EXP_Value)
====================
KX_Mesh(EXP_Value)
==================

.. module:: bge.types

base class --- :class:`EXP_Value`

.. class:: KX_MeshProxy(EXP_Value)
.. class:: KX_Mesh(EXP_Value)

A mesh object.

Expand Down
18 changes: 9 additions & 9 deletions source/gameengine/Converter/BL_BlenderConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "KX_Scene.h"
#include "KX_GameObject.h"
#include "KX_WorldInfo.h"
#include "RAS_Mesh.h"
#include "KX_Mesh.h"
#include "RAS_BucketManager.h"
#include "KX_PhysicsEngineEnums.h"
#include "KX_KetsjiEngine.h"
Expand Down Expand Up @@ -118,7 +118,7 @@ void BL_BlenderConverter::SceneSlot::Merge(const BL_BlenderSceneConverter& conve
for (KX_BlenderMaterial *mat : converter.m_materials) {
m_materials.emplace_back(mat);
}
for (RAS_Mesh *meshobj : converter.m_meshobjects) {
for (KX_Mesh *meshobj : converter.m_meshobjects) {
m_meshobjects.emplace_back(meshobj);
}
for (BL_ConvertObjectInfo *info : converter.m_objectInfos) {
Expand Down Expand Up @@ -474,7 +474,7 @@ KX_LibLoadStatus *BL_BlenderConverter::LinkBlendFile(BlendHandle *blendlib, cons
if (options & LIB_LOAD_VERBOSE) {
CM_Debug("mesh name: " << mesh->name + 2);
}
RAS_Mesh *meshobj = BL_ConvertMesh((Mesh *)mesh, nullptr, scene_merge, sceneConverter);
KX_Mesh *meshobj = BL_ConvertMesh((Mesh *)mesh, nullptr, scene_merge, sceneConverter);
scene_merge->GetLogicManager()->RegisterMeshName(meshobj->GetName(), meshobj);
}

Expand Down Expand Up @@ -608,7 +608,7 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie)
// in case the mesh might be refered to later
std::map<std::string, void *> &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap();
for (std::map<std::string, void *>::iterator it = mapStringToMeshes.begin(), end = mapStringToMeshes.end(); it != end;) {
RAS_Mesh *meshobj = (RAS_Mesh *)it->second;
KX_Mesh *meshobj = (KX_Mesh *)it->second;
if (meshobj && IS_TAGGED(meshobj->GetMesh())) {
it = mapStringToMeshes.erase(it);
}
Expand Down Expand Up @@ -655,7 +655,7 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie)
gameobj->RemoveTaggedActions();
// free the mesh, we could be referecing a linked one!

for (RAS_Mesh *meshobj : gameobj->GetMeshList()) {
for (KX_Mesh *meshobj : gameobj->GetMeshList()) {
if (IS_TAGGED(meshobj->GetMesh())) {
gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */
break;
Expand Down Expand Up @@ -690,8 +690,8 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie)
KX_Scene *scene = sit->first;
SceneSlot& sceneSlot = sit->second;

for (UniquePtrList<RAS_Mesh>::iterator it = sceneSlot.m_meshobjects.begin(); it != sceneSlot.m_meshobjects.end(); ) {
RAS_Mesh *mesh = (*it).get();
for (UniquePtrList<KX_Mesh>::iterator it = sceneSlot.m_meshobjects.begin(); it != sceneSlot.m_meshobjects.end(); ) {
KX_Mesh *mesh = (*it).get();
if (IS_TAGGED(mesh->GetMesh())) {
it = sceneSlot.m_meshobjects.erase(it);
}
Expand Down Expand Up @@ -758,7 +758,7 @@ void BL_BlenderConverter::MergeScene(KX_Scene *to, KX_Scene *from)

/** This function merges a mesh from the current scene into another main
* it does not convert */
RAS_Mesh *BL_BlenderConverter::ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name)
KX_Mesh *BL_BlenderConverter::ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name)
{
// Find a mesh in the current main */
ID *me = static_cast<ID *>(BLI_findstring(&m_maggie->mesh, name.c_str(), offsetof(ID, name) + 2));
Expand Down Expand Up @@ -832,7 +832,7 @@ RAS_Mesh *BL_BlenderConverter::ConvertMeshSpecial(KX_Scene *kx_scene, Main *magg

BL_BlenderSceneConverter sceneConverter(kx_scene);

RAS_Mesh *meshobj = BL_ConvertMesh((Mesh *)me, nullptr, kx_scene, sceneConverter);
KX_Mesh *meshobj = BL_ConvertMesh((Mesh *)me, nullptr, kx_scene, sceneConverter);
kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(), meshobj);

// Finalize material and mesh conversion.
Expand Down
8 changes: 4 additions & 4 deletions source/gameengine/Converter/BL_BlenderConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#ifdef _MSC_VER // MSVC doesn't support incomplete type in std::unique_ptr.
# include "KX_BlenderMaterial.h"
# include "RAS_Mesh.h"
# include "KX_Mesh.h"
# include "BL_ConvertObjectInfo.h"
# include "BL_BlenderScalarInterpolator.h"
#endif
Expand All @@ -53,7 +53,7 @@ class KX_BlenderMaterial;
class BL_InterpolatorList;
class SCA_IActuator;
class SCA_IController;
class RAS_Mesh;
class KX_Mesh;
struct Main;
struct BlendHandle;
struct Mesh;
Expand All @@ -74,7 +74,7 @@ class BL_BlenderConverter
{
public:
UniquePtrList<KX_BlenderMaterial> m_materials;
UniquePtrList<RAS_Mesh> m_meshobjects;
UniquePtrList<KX_Mesh> m_meshobjects;
UniquePtrList<BL_InterpolatorList> m_interpolators;
UniquePtrList<BL_ConvertObjectInfo> m_objectInfos;

Expand Down Expand Up @@ -148,7 +148,7 @@ class BL_BlenderConverter
bool FreeBlendFile(Main *maggie);
bool FreeBlendFile(const std::string& path);

RAS_Mesh *ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name);
KX_Mesh *ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name);

void MergeScene(KX_Scene *to, KX_Scene *from);

Expand Down
20 changes: 10 additions & 10 deletions source/gameengine/Converter/BL_BlenderDataConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
# include "CcdGraphicController.h"
#endif

#include "RAS_Mesh.h"
#include "RAS_Rasterizer.h"
#include "RAS_ILightObject.h"

Expand All @@ -88,6 +87,7 @@
#include "KX_LodManager.h"
#include "KX_PythonComponent.h"
#include "KX_WorldInfo.h"
#include "KX_Mesh.h"
#include "KX_BlenderMaterial.h"
#include "KX_TextureRendererManager.h"
#include "KX_Globals.h"
Expand Down Expand Up @@ -408,9 +408,9 @@ static RAS_MaterialBucket *BL_ConvertMaterial(Material *ma, int lightlayer, KX_S
}

/* blenderobj can be nullptr, make sure its checked for */
RAS_Mesh *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL_BlenderSceneConverter& converter)
KX_Mesh *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL_BlenderSceneConverter& converter)
{
RAS_Mesh *meshobj;
KX_Mesh *meshobj;
const int lightlayer = blenderobj ? blenderobj->lay : (1 << 20) - 1; // all layers if no object.

// Without checking names, we get some reuse we don't want that can cause
Expand Down Expand Up @@ -453,7 +453,7 @@ RAS_Mesh *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL_Blend
vertformat.uvSize = max_ii(1, uvCount);
vertformat.colorSize = max_ii(1, colorCount);

meshobj = new RAS_Mesh(me, layersInfo);
meshobj = new KX_Mesh(me, layersInfo);

const unsigned short totmat = max_ii(me->totcol, 1);
std::vector<BL_MeshMaterial> mats(totmat);
Expand Down Expand Up @@ -640,7 +640,7 @@ static void BL_CreateGraphicObjectNew(KX_GameObject *gameobj, KX_Scene *kxscene,
}
}

static void BL_CreatePhysicsObjectNew(KX_GameObject *gameobj, Object *blenderobject, RAS_Mesh *meshobj,
static void BL_CreatePhysicsObjectNew(KX_GameObject *gameobj, Object *blenderobject, KX_Mesh *meshobj,
KX_Scene *kxscene, int activeLayerBitInfo, BL_BlenderSceneConverter& converter, bool processCompoundChildren)

{
Expand Down Expand Up @@ -864,7 +864,7 @@ static KX_GameObject *BL_GameObjectFromBlenderObject(Object *ob, KX_Scene *kxsce
case OB_MESH:
{
Mesh *mesh = static_cast<Mesh *>(ob->data);
RAS_Mesh *meshobj = BL_ConvertMesh(mesh, ob, kxscene, converter);
KX_Mesh *meshobj = BL_ConvertMesh(mesh, ob, kxscene, converter);

// needed for python scripting
kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(), meshobj);
Expand Down Expand Up @@ -1538,8 +1538,8 @@ void BL_ConvertBlenderObjects(struct Main *maggie,
for (KX_GameObject *gameobj : sumolist) {
Object *blenderobject = gameobj->GetBlenderObject();

const std::vector<RAS_Mesh *>& meshes = gameobj->GetMeshList();
RAS_Mesh *meshobj = (meshes.empty()) ? nullptr : meshes.front();
const std::vector<KX_Mesh *>& meshes = gameobj->GetMeshList();
KX_Mesh *meshobj = (meshes.empty()) ? nullptr : meshes.front();

int layerMask = (groupobj.find(blenderobject) == groupobj.end()) ? activeLayerBitInfo : 0;
BL_CreatePhysicsObjectNew(gameobj, blenderobject, meshobj, kxscene, layerMask, converter, processCompoundChildren);
Expand All @@ -1548,7 +1548,7 @@ void BL_ConvertBlenderObjects(struct Main *maggie,

// Look at every material texture and ask to create realtime cube map.
for (KX_GameObject *gameobj : sumolist) {
for (RAS_Mesh *mesh : gameobj->GetMeshList()) {
for (KX_Mesh *mesh : gameobj->GetMeshList()) {
for (RAS_MeshMaterial *meshmat : mesh->GetMeshMaterialList()) {
RAS_IPolyMaterial *polymat = meshmat->GetBucket()->GetPolyMaterial();

Expand Down Expand Up @@ -1584,7 +1584,7 @@ void BL_ConvertBlenderObjects(struct Main *maggie,
Mesh *predifinedBoundMesh = blenderobject->gamePredefinedBound;

if (predifinedBoundMesh) {
RAS_Mesh *meshobj = converter.FindGameMesh(predifinedBoundMesh);
KX_Mesh *meshobj = converter.FindGameMesh(predifinedBoundMesh);
// In case of mesh taken in a other scene.
if (!meshobj) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Converter/BL_BlenderDataConversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct BL_MeshMaterial {
bool wire;
};

RAS_Mesh *BL_ConvertMesh(Mesh *mesh, Object *lightobj, KX_Scene *scene, BL_BlenderSceneConverter& converter);
KX_Mesh *BL_ConvertMesh(Mesh *mesh, Object *lightobj, KX_Scene *scene, BL_BlenderSceneConverter& converter);
void BL_ConvertDerivedMeshToArray(DerivedMesh *dm, Mesh *me, const std::vector<BL_MeshMaterial>& mats,
const RAS_Mesh::LayersInfo& layersInfo);

Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_BlenderSceneConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ KX_GameObject *BL_BlenderSceneConverter::FindGameObject(Object *for_blenderobjec
return m_map_blender_to_gameobject[for_blenderobject];
}

void BL_BlenderSceneConverter::RegisterGameMesh(RAS_Mesh *gamemesh, Mesh *for_blendermesh)
void BL_BlenderSceneConverter::RegisterGameMesh(KX_Mesh *gamemesh, Mesh *for_blendermesh)
{
if (for_blendermesh) { // dynamically loaded meshes we don't want to keep lookups for
m_map_mesh_to_gamemesh[for_blendermesh] = gamemesh;
}
m_meshobjects.push_back(gamemesh);
}

RAS_Mesh *BL_BlenderSceneConverter::FindGameMesh(Mesh *for_blendermesh)
KX_Mesh *BL_BlenderSceneConverter::FindGameMesh(Mesh *for_blendermesh)
{
return m_map_mesh_to_gamemesh[for_blendermesh];
}
Expand Down
10 changes: 5 additions & 5 deletions source/gameengine/Converter/BL_BlenderSceneConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

class SCA_IActuator;
class SCA_IController;
class RAS_Mesh;
class KX_Mesh;
class KX_BlenderMaterial;
class BL_BlenderConverter;
class BL_ConvertObjectInfo;
Expand All @@ -63,12 +63,12 @@ class BL_BlenderSceneConverter
KX_Scene *m_scene;

std::vector<KX_BlenderMaterial *> m_materials;
std::vector<RAS_Mesh *> m_meshobjects;
std::vector<KX_Mesh *> m_meshobjects;
std::vector<BL_ConvertObjectInfo *> m_objectInfos;

std::map<Object *, BL_ConvertObjectInfo *> m_blenderToObjectInfos;
std::map<Object *, KX_GameObject *> m_map_blender_to_gameobject;
std::map<Mesh *, RAS_Mesh *> m_map_mesh_to_gamemesh;
std::map<Mesh *, KX_Mesh *> m_map_mesh_to_gamemesh;
std::map<Material *, KX_BlenderMaterial *> m_map_mesh_to_polyaterial;
std::map<bActuator *, SCA_IActuator *> m_map_blender_to_gameactuator;
std::map<bController *, SCA_IController *> m_map_blender_to_gamecontroller;
Expand All @@ -88,8 +88,8 @@ class BL_BlenderSceneConverter
void UnregisterGameObject(KX_GameObject *gameobject);
KX_GameObject *FindGameObject(Object *for_blenderobject);

void RegisterGameMesh(RAS_Mesh *gamemesh, Mesh *for_blendermesh);
RAS_Mesh *FindGameMesh(Mesh *for_blendermesh);
void RegisterGameMesh(KX_Mesh *gamemesh, Mesh *for_blendermesh);
KX_Mesh *FindGameMesh(Mesh *for_blendermesh);

void RegisterMaterial(KX_BlenderMaterial *blmat, Material *mat);
KX_BlenderMaterial *FindMaterial(Material *mat);
Expand Down
3 changes: 1 addition & 2 deletions source/gameengine/Converter/BL_ConvertActuators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ void BL_ConvertActuators(const char* maggiename,
break;
case ACT_EDOB_REPLACE_MESH:
{
RAS_Mesh *tmpmesh = converter.FindGameMesh(editobact->me);
KX_Mesh *tmpmesh = converter.FindGameMesh(editobact->me);

if (!tmpmesh) {
CM_Warning("object \"" << objectname << "\" from ReplaceMesh actuator \"" << uniquename
Expand All @@ -471,7 +471,6 @@ void BL_ConvertActuators(const char* maggiename,
KX_ReplaceMeshActuator* tmpreplaceact = new KX_ReplaceMeshActuator(
gameobj,
tmpmesh,
scene,
(editobact->flag & ACT_EDOB_REPLACE_MESH_NOGFX) == 0,
(editobact->flag & ACT_EDOB_REPLACE_MESH_PHYS) != 0);

Expand Down
5 changes: 2 additions & 3 deletions source/gameengine/Converter/BL_DeformableGameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
#include "BL_MeshDeformer.h"

#include "KX_SoftBodyDeformer.h"

#include "RAS_Mesh.h"
#include "KX_Mesh.h"

#include "CM_Message.h"

Expand Down Expand Up @@ -135,7 +134,7 @@ void BL_DeformableGameObject::LoadDeformer()
return;
}

RAS_Mesh *meshobj = m_meshes.front();
KX_Mesh *meshobj = m_meshes.front();
Mesh *mesh = meshobj->GetMesh();

if (!mesh) {
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Ketsji/BL_Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include "BL_IpoConvert.h"
#include "KX_GameObject.h"
#include "KX_Globals.h"
#include "KX_Mesh.h"

#include "RAS_Mesh.h"
#include "RAS_MaterialBucket.h"

#include "SG_Controller.h"
Expand Down Expand Up @@ -186,7 +186,7 @@ bool BL_Action::Play(const std::string& name,
}

// Now try materials
for (RAS_Mesh *mesh : m_obj->GetMeshList()) {
for (KX_Mesh *mesh : m_obj->GetMeshList()) {
for (RAS_MeshMaterial *meshmat : mesh->GetMeshMaterialList()) {
RAS_IPolyMaterial *polymat = meshmat->GetBucket()->GetPolyMaterial();

Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Ketsji/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ set(SRC
KX_LodLevel.cpp
KX_LodManager.cpp
KX_MaterialIpoController.cpp
KX_MeshProxy.cpp
KX_Mesh.cpp
KX_MotionState.cpp
KX_MouseActuator.cpp
KX_MouseFocusSensor.cpp
Expand Down Expand Up @@ -191,7 +191,7 @@ set(SRC
KX_LodLevel.h
KX_LodManager.h
KX_MaterialIpoController.h
KX_MeshProxy.h
KX_Mesh.h
KX_MotionState.h
KX_MouseActuator.h
KX_MouseFocusSensor.h
Expand Down
7 changes: 3 additions & 4 deletions source/gameengine/Ketsji/KX_CollisionSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@
#include "SCA_LogicManager.h"
#include "KX_GameObject.h"
#include "KX_CollisionEventManager.h"
#include "KX_Mesh.h"

#include "PHY_IPhysicsController.h"

#include "RAS_Mesh.h"

#include <iostream>
#include "BLI_utildefines.h"
#include "PHY_IPhysicsEnvironment.h"
Expand Down Expand Up @@ -211,7 +210,7 @@ bool KX_CollisionSensor::BroadPhaseSensorFilterCollision(PHY_IPhysicsController
bool found = m_touchedpropname.empty();
if (!found) {
if (m_bFindMaterial) {
for (RAS_Mesh *meshObj : otherobj->GetMeshList()) {
for (KX_Mesh *meshObj : otherobj->GetMeshList()) {
found = (meshObj->FindMaterialName(m_touchedpropname) != nullptr);
if (found) {
break;
Expand Down Expand Up @@ -248,7 +247,7 @@ bool KX_CollisionSensor::NewHandleCollision(PHY_IPhysicsController *ctrl1, PHY_I
bool hitMaterial = false;
if (!found) {
if (m_bFindMaterial) {
for (RAS_Mesh *meshObj : gameobj->GetMeshList()) {
for (KX_Mesh *meshObj : gameobj->GetMeshList()) {
found = (meshObj->FindMaterialName(m_touchedpropname) != nullptr);
if (found) {
hitMaterial = true;
Expand Down
Loading

0 comments on commit 92af8d6

Please sign in to comment.