GadgetSet.cpp (pymol-open-source-2.2.0) | : | GadgetSet.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
#include"Err.h" | #include"Err.h" | |||
#include"Scene.h" | #include"Scene.h" | |||
#include"GadgetSet.h" | #include"GadgetSet.h" | |||
#include"Color.h" | #include"Color.h" | |||
#include"PConv.h" | #include"PConv.h" | |||
#include"main.h" | #include"main.h" | |||
#include"CGO.h" | #include"CGO.h" | |||
#include"ShaderMgr.h" | #include"ShaderMgr.h" | |||
#include"Ray.h" | #include"Ray.h" | |||
void GadgetSetStrip(GadgetSet * I); | ||||
int GadgetSetGetVertex(GadgetSet * I, int index, int base, float *v) | int GadgetSetGetVertex(GadgetSet * I, int index, int base, float *v) | |||
{ | { | |||
int ok = true; | int ok = true; | |||
float *v0, *v1; | float *v0, *v1; | |||
if(index < I->NCoord) { | if(index < I->NCoord) { | |||
v0 = I->Coord + 3 * index; | v0 = I->Coord + 3 * index; | |||
if(base < 0) { | if(base < 0) { | |||
copy3f(v0, v); | copy3f(v0, v); | |||
if(index){ | if(index){ | |||
add3f(I->Coord, v, v); | add3f(I->Coord, v, v); | |||
skipping to change at line 93 | skipping to change at line 91 | |||
ok = false; | ok = false; | |||
} | } | |||
} else | } else | |||
ok = false; | ok = false; | |||
return (ok); | return (ok); | |||
} | } | |||
int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int version) | int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int version) | |||
{ | { | |||
int ok = true; | int ok = true; | |||
int ll; | ||||
GadgetSet *I = NULL; | GadgetSet *I = NULL; | |||
PyObject *tmp = NULL; | PyObject *tmp = NULL; | |||
if(*gs) { | if(*gs) { | |||
(*gs)->fFree(); | (*gs)->fFree(); | |||
*gs = NULL; | *gs = NULL; | |||
} | } | |||
if(list == Py_None) { /* allow None for GSet */ | if(list == Py_None) { /* allow None for GSet */ | |||
*gs = NULL; | *gs = NULL; | |||
} else { | } else { | |||
if(ok) | if(ok) | |||
I = GadgetSetNew(G); | I = GadgetSetNew(G); | |||
if(ok) | if(ok) | |||
ok = (I != NULL); | ok = (I != NULL); | |||
if(ok) | if(ok) | |||
ok = (list != NULL); | ok = (list != NULL); | |||
if(ok) | if(ok) | |||
ok = PyList_Check(list); | ok = PyList_Check(list); | |||
if(ok) | ||||
ll = PyList_Size(list); | ||||
/* 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 */ | |||
if(ok) | if(ok) | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 0), &I->NCoord); | ok = PConvPyIntToInt(PyList_GetItem(list, 0), &I->NCoord); | |||
if(ok && I->NCoord) | if(ok && I->NCoord) | |||
ok = PConvPyListToFloatVLA(PyList_GetItem(list, 1), &I->Coord); | ok = PConvPyListToFloatVLA(PyList_GetItem(list, 1), &I->Coord); | |||
if(ok) | if(ok) | |||
ok = PConvPyIntToInt(PyList_GetItem(list, 2), &I->NNormal); | ok = PConvPyIntToInt(PyList_GetItem(list, 2), &I->NNormal); | |||
skipping to change at line 283 | skipping to change at line 278 | |||
I->PickCGO = NULL; | I->PickCGO = NULL; | |||
} | } | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void GadgetSet::render(RenderInfo * info) | void GadgetSet::render(RenderInfo * info) | |||
{ | { | |||
GadgetSet * I = this; | GadgetSet * I = this; | |||
int pass = info->pass; | int pass = info->pass; | |||
CRay *ray = info->ray; | CRay *ray = info->ray; | |||
Picking **pick = info->pick; | auto pick = info->pick; | |||
const float *color; | const float *color; | |||
PickContext context; | PickContext context; | |||
context.object = I->Obj; | context.object = I->Obj; | |||
context.state = I->State; | context.state = I->State; | |||
color = ColorGet(I->G, I->Obj->Obj.Color); | color = ColorGet(I->G, I->Obj->Obj.Color); | |||
if(pass < 0 || ray || pick) { | if(pass < 0 || ray || pick) { | |||
PyMOLGlobals *G = I->G; | PyMOLGlobals *G = I->G; | |||
skipping to change at line 420 | skipping to change at line 415 | |||
I->StdCGO = NULL; | I->StdCGO = NULL; | |||
I->ShapeCGO = NULL; | I->ShapeCGO = NULL; | |||
I->PickShapeCGO = NULL; | I->PickShapeCGO = NULL; | |||
I->offsetPtOP = 0; | I->offsetPtOP = 0; | |||
I->offsetPtOPick = 0; | I->offsetPtOPick = 0; | |||
return (I); | return (I); | |||
} | } | |||
/*========================================================================*/ | /*========================================================================*/ | |||
void GadgetSetStrip(GadgetSet * I) | ||||
{ | ||||
} | ||||
/*========================================================================*/ | ||||
void GadgetSet::fFree() | void GadgetSet::fFree() | |||
{ | { | |||
GadgetSet * I = this; | GadgetSet * I = this; | |||
if(I) { | if(I) { | |||
CGOFree(I->PickCGO); | CGOFree(I->PickCGO); | |||
CGOFree(I->PickShapeCGO); | CGOFree(I->PickShapeCGO); | |||
CGOFree(I->StdCGO); | CGOFree(I->StdCGO); | |||
CGOFree(I->ShapeCGO); | CGOFree(I->ShapeCGO); | |||
I->offsetPtOP = 0; | I->offsetPtOP = 0; | |||
I->offsetPtOPick = 0; | I->offsetPtOPick = 0; | |||
End of changes. 5 change blocks. | ||||
11 lines changed or deleted | 1 lines changed or added |