Browse Source

Merge pull request #241 from Hoikas/camstack

PtGetCameraNumber() fixes
Branan Purvine-Riley 12 years ago
parent
commit
675493cf36
  1. 5
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp
  2. 10
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  3. 2
      Sources/Plasma/FeatureLib/pfPython/cyMisc.h
  4. 2
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp

5
Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp

@ -227,7 +227,10 @@ plVirtualCam1::~plVirtualCam1()
// for saving camera stack
plCameraModifier1* plVirtualCam1::GetCameraNumber(size_t camNumber)
{
return (fCameraStack[camNumber]);
if (fCameraStack.size() > camNumber)
return fCameraStack[camNumber];
else
return nil;
}
// for rebuilding camera stack
void plVirtualCam1::RebuildStack(const plKey& key)

10
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -2459,14 +2459,14 @@ int cyMisc::GetNumCameras()
return (plVirtualCam1::Instance()->GetNumCameras());
}
const char* cyMisc::GetCameraNumber(int number)
plString cyMisc::GetCameraNumber(int number)
{
plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCameraNumber(number-1);
if (pCam->GetTarget())
if (pCam && pCam->GetTarget())
{
const char* ret = pCam->GetTarget()->GetKeyName().c_str();
plString str = plString::Format("saving camera named %s to chronicle\n",ret);
plVirtualCam1::Instance()->AddMsgToLog(str.c_str());
plString ret = pCam->GetTarget()->GetKeyName();
plString log = plString::Format("saving camera named %s to chronicle\n", ret.c_str());
plVirtualCam1::Instance()->AddMsgToLog(log.c_str());
return ret;
}
plVirtualCam1::Instance()->AddMsgToLog("sending empty to camera chronicle\n");

2
Sources/Plasma/FeatureLib/pfPython/cyMisc.h

@ -809,7 +809,7 @@ public:
//
static int GetNumCameras();
static const char* GetCameraNumber(int number);
static plString GetCameraNumber(int number);
static void RebuildCameraStack(const plString& name, const char* ageName);
static void PyClearCameraStack();
static void RecenterCamera();

2
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp

@ -337,7 +337,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetCameraNumber, args, "Params: x\nReturns cam
PyErr_SetString(PyExc_TypeError, "PtGetCameraNumber expects an int");
PYTHON_RETURN_ERROR;
}
return PyString_FromString(cyMisc::GetCameraNumber(x));
return PyString_FromPlString(cyMisc::GetCameraNumber(x));
}
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetNumCameras, "returns camera stack size")

Loading…
Cancel
Save