"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer3/MovieScene.cpp" between
pymol-v1.8.6.0.tar.bz2 and pymol-v2.1.0.tar.bz2

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

MovieScene.cpp  (pymol-v1.8.6.0.tar.bz2):MovieScene.cpp  (pymol-v2.1.0.tar.bz2)
skipping to change at line 21 skipping to change at line 21
#include "Movie.h" #include "Movie.h"
#include "P.h" #include "P.h"
#include "PConv.h" #include "PConv.h"
#include "PConvArgs.h" #include "PConvArgs.h"
#include "Setting.h" #include "Setting.h"
#include "Scene.h" #include "Scene.h"
#include "View.h" #include "View.h"
#include "Selector.h" #include "Selector.h"
#include "Executive.h" #include "Executive.h"
#include "Err.h" #include "Err.h"
#include "SpecRec.h"
#include <algorithm> #include <algorithm>
#include <map> #include <map>
#include <set> #include <set>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#include "MovieScene.h" #include "MovieScene.h"
skipping to change at line 232 skipping to change at line 233
*/ */
static bool MovieSceneStore(PyMOLGlobals * G, const char * name, static bool MovieSceneStore(PyMOLGlobals * G, const char * name,
const char * message, const char * message,
bool store_view, bool store_view,
bool store_color, bool store_color,
bool store_active, bool store_active,
bool store_rep, bool store_rep,
bool store_frame, bool store_frame,
const char * sele) const char * sele)
{ {
auto scenes = G->scenes;
std::string key(name); std::string key(name);
// new key? // new key?
if (key.empty() || key == "new") { if (key.empty() || key == "new") {
key = G->scenes->getUniqueKey(); key = scenes->getUniqueKey();
G->scenes->order.push_back(key); scenes->order.push_back(key);
} else if (G->scenes->dict.find(key) == G->scenes->dict.end()) { } else if (scenes->dict.find(key) == scenes->dict.end()) {
G->scenes->order.push_back(key); scenes->order.push_back(key);
} }
SceneSetNames(G, G->scenes->order); SceneSetNames(G, scenes->order);
// set scene_current_name // set scene_current_name
SettingSetGlobal_s(G, cSetting_scene_current_name, key.c_str()); SettingSetGlobal_s(G, cSetting_scene_current_name, key.c_str());
MovieScene &scene = G->scenes->dict[key]; MovieScene &scene = scenes->dict[key];
// storemask // storemask
scene.storemask = ( scene.storemask = (
(store_view ? STORE_VIEW : 0) | (store_view ? STORE_VIEW : 0) |
(store_active ? STORE_ACTIVE : 0) | (store_active ? STORE_ACTIVE : 0) |
(store_color ? STORE_COLOR : 0) | (store_color ? STORE_COLOR : 0) |
(store_rep ? STORE_REP : 0) | (store_rep ? STORE_REP : 0) |
(store_frame ? STORE_FRAME : 0)); (store_frame ? STORE_FRAME : 0));
// message // message
skipping to change at line 287 skipping to change at line 289
int unique_id = AtomInfoCheckUniqueID(G, ai); int unique_id = AtomInfoCheckUniqueID(G, ai);
MovieSceneAtom &sceneatom = scene.atomdata[unique_id]; MovieSceneAtom &sceneatom = scene.atomdata[unique_id];
sceneatom.color = ai->color; sceneatom.color = ai->color;
sceneatom.visRep = ai->visRep; sceneatom.visRep = ai->visRep;
} }
} }
// objectdata // objectdata
for (ObjectIterator iter(G); iter.next();) { for (ObjectIterator iter(G); iter.next();) {
const SpecRec * rec = iter.getSpecRec();
CObject * obj = iter.getObject(); CObject * obj = iter.getObject();
MovieSceneObject &sceneobj = scene.objectdata[obj->Name]; MovieSceneObject &sceneobj = scene.objectdata[obj->Name];
sceneobj.color = obj->Color; sceneobj.color = obj->Color;
sceneobj.visRep = obj->visRep; sceneobj.visRep = obj->visRep;
// store the "enabled" state in the first bit of visRep // store the "enabled" state in the first bit of visRep
SET_BIT_TO(sceneobj.visRep, 0, obj->Enabled); SET_BIT_TO(sceneobj.visRep, 0, rec->visible);
} }
PRINTFB(G, FB_Scene, FB_Details) PRINTFB(G, FB_Scene, FB_Details)
" scene: scene stored as \"%s\".\n", key.c_str() ENDFB(G); " scene: scene stored as \"%s\".\n", key.c_str() ENDFB(G);
return true; return true;
} }
/* /*
* Display a message (with the message wizard) * Display a message (with the message wizard)
skipping to change at line 346 skipping to change at line 349
#ifdef _PYMOL_NOPY #ifdef _PYMOL_NOPY
SceneSetFrame(G, mode, frame); SceneSetFrame(G, mode, frame);
#else #else
// PBlock fails with SceneSetFrame. Workaround: call from Python // PBlock fails with SceneSetFrame. Workaround: call from Python
PXDecRef(PYOBJECT_CALLMETHOD(G->P_inst->cmd, "set_frame", "ii", frame + 1, mod e)); PXDecRef(PYOBJECT_CALLMETHOD(G->P_inst->cmd, "set_frame", "ii", frame + 1, mod e));
#endif #endif
} }
/* /*
* Scene animation duration from settings
*/
static float get_scene_animation_duration(PyMOLGlobals * G) {
auto enabled = SettingGetGlobal_i(G, cSetting_scene_animation);
if (enabled < 0)
enabled = SettingGetGlobal_b(G, cSetting_animation);
if (!enabled)
return 0.f;
return SettingGetGlobal_f(G, cSetting_scene_animation_duration);
}
/*
* Recall a scene * Recall a scene
* *
* name: name (key) of the scene to recall * name: name (key) of the scene to recall
* animate: animation duration, use scene_animation_duration if -1 * animate: animation duration, use scene_animation_duration if -1
* store_view: restore the camera view * store_view: restore the camera view
* store_color: restore colors * store_color: restore colors
* store_active: restore enabled/disabled * store_active: restore enabled/disabled
* store_rep: restore reps * store_rep: restore reps
*/ */
bool MovieSceneRecall(PyMOLGlobals * G, const char * name, float animate, bool MovieSceneRecall(PyMOLGlobals * G, const char * name, float animate,
bool recall_view, bool recall_view,
bool recall_color, bool recall_color,
bool recall_active, bool recall_active,
bool recall_rep, bool recall_rep,
bool recall_frame, bool recall_frame,
const char * sele) const char * sele)
{ {
auto it = G->scenes->dict.find(name); auto scenes = G->scenes;
auto it = scenes->dict.find(name);
if (it == G->scenes->dict.end()) { if (it == scenes->dict.end()) {
PRINTFB(G, FB_Scene, FB_Errors) PRINTFB(G, FB_Scene, FB_Errors)
" Error: scene '%s' is not defined.\n", name " Error: scene '%s' is not defined.\n", name
ENDFB(G); ENDFB(G);
return false; return false;
} }
// set scene_current_name // set scene_current_name
SettingSetGlobal_s(G, cSetting_scene_current_name, name); SettingSetGlobal_s(G, cSetting_scene_current_name, name);
MovieScene &scene = it->second; MovieScene &scene = it->second;
skipping to change at line 465 skipping to change at line 483
// invalidate // invalidate
for (auto it = objectstoinvalidate.begin(); for (auto it = objectstoinvalidate.begin();
it != objectstoinvalidate.end(); ++it) { it != objectstoinvalidate.end(); ++it) {
it->first->invalidate(cRepAll, it->second ? cRepInvVisib : cRepInvColor, -1) ; it->first->invalidate(cRepAll, it->second ? cRepInvVisib : cRepInvColor, -1) ;
} }
// camera view // camera view
if (recall_view) { if (recall_view) {
if (animate < -0.5) // == -1 if (animate < -0.5) // == -1
animate = SettingGetGlobal_f(G, cSetting_scene_animation_duration); animate = get_scene_animation_duration(G);
SceneSetView(G, scene.view, true, animate, 1); SceneSetView(G, scene.view, true, animate, 1);
} }
// message // message
MovieSceneRecallMessage(G, scene.message); MovieSceneRecallMessage(G, scene.message);
// frame // frame
if (recall_frame) { if (recall_frame) {
MovieSceneRecallFrame(G, scene.frame); MovieSceneRecallFrame(G, scene.frame);
skipping to change at line 643 skipping to change at line 661
bool store_view, bool store_view,
bool store_color, bool store_color,
bool store_active, bool store_active,
bool store_rep, bool store_rep,
bool store_frame, bool store_frame,
float animate, float animate,
const char * new_key, const char * new_key,
bool hand, bool hand,
const char * sele) const char * sele)
{ {
auto scenes = G->scenes;
std::string prev_name; std::string prev_name;
short beforeafter = 0; short beforeafter = 0;
bool status = false; bool status = false;
PRINTFB(G, FB_Scene, FB_Blather) PRINTFB(G, FB_Scene, FB_Blather)
" MovieScene: key=%s action=%s message=%s store_view=%d store_color=%d" " MovieScene: key=%s action=%s message=%s store_view=%d store_color=%d"
" store_active=%d store_rep=%d animate=%f new_key=%s hand=%d\n", " store_active=%d store_rep=%d animate=%f new_key=%s hand=%d\n",
key, action, message, store_view, store_color, store_active, store_rep, key, action, message, store_view, store_color, store_active, store_rep,
animate, new_key, hand animate, new_key, hand
ENDFB(G); ENDFB(G);
skipping to change at line 664 skipping to change at line 683
// insert_before, insert_after // insert_before, insert_after
if (strncmp(action, "insert_", 7) == 0) { if (strncmp(action, "insert_", 7) == 0) {
prev_name = SettingGetGlobal_s(G, cSetting_scene_current_name); prev_name = SettingGetGlobal_s(G, cSetting_scene_current_name);
if (!prev_name.empty()) if (!prev_name.empty())
beforeafter = (action[7] == 'b') ? 1 : 2; beforeafter = (action[7] == 'b') ? 1 : 2;
action = "store"; action = "store";
} }
if (strcmp(action, "next") == 0 || if (strcmp(action, "next") == 0 ||
strcmp(action, "previous") == 0) { strcmp(action, "previous") == 0) {
ok_assert(NOSCENES, G->scenes->order.size()); ok_assert(NOSCENES, scenes->order.size());
key = MovieSceneGetNextKey(G, action[0] == 'n'); key = MovieSceneGetNextKey(G, action[0] == 'n');
action = "recall"; action = "recall";
} else if (strcmp(action, "start") == 0) { } else if (strcmp(action, "start") == 0) {
ok_assert(NOSCENES, G->scenes->order.size()); ok_assert(NOSCENES, scenes->order.size());
key = G->scenes->order[0].c_str(); key = scenes->order[0].c_str();
action = "recall"; action = "recall";
} else if (strcmp(key, "auto") == 0) { } else if (strcmp(key, "auto") == 0) {
key = SettingGetGlobal_s(G, cSetting_scene_current_name); key = SettingGetGlobal_s(G, cSetting_scene_current_name);
} }
if (strcmp(action, "recall") == 0) { if (strcmp(action, "recall") == 0) {
if (strcmp(key, "*") == 0) if (strcmp(key, "*") == 0)
return MovieScenePrintOrder(G); return MovieScenePrintOrder(G);
if (!key[0]) { if (!key[0]) {
 End of changes. 15 change blocks. 
13 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)