Crystal.cpp (pymol-v1.8.6.0.tar.bz2) | : | Crystal.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
#include"Err.h" | #include"Err.h" | |||
#include"Base.h" | #include"Base.h" | |||
#include"OOMac.h" | #include"OOMac.h" | |||
#include"Crystal.h" | #include"Crystal.h" | |||
#include"Feedback.h" | #include"Feedback.h" | |||
#include"Util.h" | #include"Util.h" | |||
#include"PConv.h" | #include"PConv.h" | |||
PyObject *CrystalAsPyList(CCrystal * I) | PyObject *CrystalAsPyList(CCrystal * I) | |||
{ | { | |||
#ifdef _PYMOL_NOPY | ||||
return NULL; | ||||
#else | ||||
PyObject *result = NULL; | PyObject *result = NULL; | |||
if(I) { | if(I) { | |||
result = PyList_New(2); | result = PyList_New(2); | |||
PyList_SetItem(result, 0, PConvFloatArrayToPyList(I->Dim, 3)); | PyList_SetItem(result, 0, PConvFloatArrayToPyList(I->Dim, 3)); | |||
PyList_SetItem(result, 1, PConvFloatArrayToPyList(I->Angle, 3)); | PyList_SetItem(result, 1, PConvFloatArrayToPyList(I->Angle, 3)); | |||
} | } | |||
return (PConvAutoNone(result)); | return (PConvAutoNone(result)); | |||
#endif | ||||
} | } | |||
int CrystalFromPyList(CCrystal * I, PyObject * list) | int CrystalFromPyList(CCrystal * I, PyObject * list) | |||
{ | { | |||
#ifdef _PYMOL_NOPY | ||||
return 0; | ||||
#else | ||||
int ok = true, rok = true; | int ok = true, rok = true; | |||
int ll = 0; | int ll = 0; | |||
if(ok) | if(ok) | |||
ok = (I != NULL); | ok = (I != NULL); | |||
if(ok) | if(ok) | |||
ok = PyList_Check(list); | ok = PyList_Check(list); | |||
if(ok) | if(ok) | |||
ll = PyList_Size(list); | ll = PyList_Size(list); | |||
rok = ok; | rok = ok; | |||
if(ok && (ll > 0)) | if(ok && (ll > 0)) | |||
ok = PConvPyListToFloatArrayInPlace(PyList_GetItem(list, 0), I->Dim, 3); | ok = PConvPyListToFloatArrayInPlace(PyList_GetItem(list, 0), I->Dim, 3); | |||
if(ok && (ll > 1)) | if(ok && (ll > 1)) | |||
ok = PConvPyListToFloatArrayInPlace(PyList_GetItem(list, 1), I->Angle, 3); | ok = PConvPyListToFloatArrayInPlace(PyList_GetItem(list, 1), I->Angle, 3); | |||
if(ok) | if(ok) | |||
CrystalUpdate(I); | CrystalUpdate(I); | |||
/* TO SUPPORT BACKWARDS COMPATIBILITY... | /* TO SUPPORT BACKWARDS COMPATIBILITY... | |||
Always check ll when adding new PyList_GetItem's */ | Always check ll when adding new PyList_GetItem's */ | |||
return (rok); | return (rok); | |||
#endif | ||||
} | } | |||
void CrystalFree(CCrystal * I) | void CrystalFree(CCrystal * I) | |||
{ | { | |||
OOFreeP(I); | OOFreeP(I); | |||
} | } | |||
void CrystalInit(PyMOLGlobals * G, CCrystal * I) | void CrystalInit(PyMOLGlobals * G, CCrystal * I) | |||
{ | { | |||
int a; | int a; | |||
End of changes. 4 change blocks. | ||||
9 lines changed or deleted | 0 lines changed or added |