diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 15 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.h | 18 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SceneActuator.cpp | 9 |
4 files changed, 43 insertions, 5 deletions
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 68024100719..a9b84e8f51f 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -684,15 +684,11 @@ void BL_ConvertActuators(char* maggiename, break; } case ACT_SCENE_CAMERA: + mode = KX_SceneActuator::KX_SCENE_SET_CAMERA; if (sceneact->camera) { - mode = KX_SceneActuator::KX_SCENE_SET_CAMERA; cam = (KX_Camera*) converter->FindGameObject(sceneact->camera); } - else - { - // TODO:warn user - } break; case ACT_SCENE_RESTART: { diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index b75662f01c9..aa15199b816 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -69,7 +69,22 @@ KX_Camera::~KX_Camera() } +CValue* KX_Camera::GetReplica() +{ + KX_Camera* replica = new KX_Camera(*this); + + // this will copy properties and so on... + CValue::AddDataToReplica(replica); + ProcessReplica(replica); + + return replica; +} +void KX_Camera::ProcessReplica(KX_Camera* replica) +{ + KX_GameObject::ProcessReplica(replica); +} + MT_Transform KX_Camera::GetWorldToCamera() const { MT_Transform camtrans; diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h index 34a3d2f2653..08f2bf3d1c1 100644 --- a/source/gameengine/Ketsji/KX_Camera.h +++ b/source/gameengine/Ketsji/KX_Camera.h @@ -134,6 +134,24 @@ public: KX_Camera(void* sgReplicationInfo,SG_Callbacks callbacks,const RAS_CameraData& camdata, bool frustum_culling = true, PyTypeObject *T = &Type); virtual ~KX_Camera(); + /** + * Inherited from CValue -- return a new copy of this + * instance allocated on the heap. Ownership of the new + * object belongs with the caller. + */ + virtual CValue* + GetReplica( + ); + + /** + * Inherited from CValue -- Makes sure any internal + * data owned by this class is deep copied. Called internally + */ + virtual void + ProcessReplica( + KX_Camera* replica + ); + MT_Transform GetWorldToCamera() const; MT_Transform GetCameraToWorld() const; diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index a37fce434be..7a9d144e92f 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -105,6 +105,15 @@ bool KX_SceneActuator::Update() { m_scene->SetActiveCamera(m_camera); } + else + { + // if no camera is set and the parent object is a camera, use it as the camera + SCA_IObject* parent = GetParent(); + if (parent->isA(&KX_Camera::Type)) + { + m_scene->SetActiveCamera((KX_Camera*)parent); + } + } break; default: break; |