[chimera-dev] Re: Xform

Thomas Goddard goddard at cgl.ucsf.edu
Wed May 14 09:16:42 PDT 2003


Hi Steve,

  The model.openState.xform is guaranteed to be a copy of the
transform object.  Other Chimera objects returned as attribute lookups
are also always copies, including Point, Vector, BBox.  Some objects
are never copied like Atom, Bond, Molecule - you always get a
reference.  It may be that the "WRAP CLASS" comment in the pyinterface
file is what marks Xform, Point, ... as objects that are always passed
by value between Chimera's Python and C++ layers.  Greg Couch
(gregc at cgl.ucsf.edu) is the one who would know if this is right.

  I will be implementing an "undo move" menu item.  I think many people
will appreciate that.

    Tom


> Date: Wed, 14 May 2003 01:20:26 -0500 (CDT)
> From: Steve Ludtke <stevel at blake.3dem.bioch.bcm.tmc.edu>
> Reply-To: sludtke at bcm.tmc.edu
> To: Thomas Goddard <goddard at cgl.ucsf.edu>
> 
> Hi again. Thanks for that include file. It's been answering most of my 
> questions. I'm putting something together I like quite a lot, and I've 
> taken care of the problem that was making me wish for an undo. As part of 
> this, though, I've come up with a technical question. What are the copying 
> semantics for Xform objects ? ie -
> 
> mx=mod.openState.xform
> (user rotates model)
> mx still has the original value
> 
> This is good, but counter to the typical behavior of objects in python. 
> That is, I would expect mx to point to an Xform object, and as long as the 
> same Xform object gets reused when the model is rotated, I should see the 
> rotated values rather than the original values. I'm not complaining, what 
> it does is actually what I'd like it to do. The question is, can I rely on 
> this behavior, or do I need to make a copy of the Xform object to make 
> sure it won't change on me. Is it just happenstance that a new object is 
> getting created upon rotation ? If I need to make a copy, how should I do 
> it ?  Will normal deep-copying python methods work ?
> 
> As usual. Thanks for the assistance. Perhaps I'll produce something to our 
> mutual benefit  :^)
> 
> -- 
> ----------------------------------------------------------------------------
> Steven Ludtke, PhD              |        Baylor College of Medicine
> sludtke at bcm.tmc.edu             |               Co-Director
> stevel at alumni.caltech.edu       | National Center For Macromolecular Imaging 
> V: (713)798-6989                |    Dept of Biochemistry and Mol. Biol.
> instant messenger: sludtke42    |            * Those who do ARE *
> http://ncmi.bcm.tmc.edu/~stevel |           The converse also holds
> 


More information about the Chimera-dev mailing list