Storing morphs displayed in the world in a GOODS db

John Pierce john.raymond.pierce at gmail.com
Thu Sep 23 14:24:11 UTC 2004


> The KKDatabase instance itself
> gets stored as the first such special object, with an ID of -1.  You
> could store the WorldMorph in there as -2.
> 
> Avi

Yes!  That works.  If you append the following line:

	specialObjects at: ActiveWorld put: -2.

to KKDatabase>>initializeWithConnection: then you can take an
on-screen morph and store in the database and re-fetch it later.  Now,
one caveat I have found is that color instances of the morph don't get
reconstituted from GOODS correctly.  I am not quite sure how to fix
it.

All I know is that if you put a "Morph new" into GOODS, come back
later (it is important to try this on another connection so as to
force getting a new instance) and show the stored morph in the world
you will get a BitBlt (Fraction?) walkback.  You might think that the
morph just doesn't work from GOODS (and it doesn't).  But if you
inspect the bad morph and say to its color instance "flushCache" then
you CAN show the morph again -- all is well.

So taking this rabit trail one more step I noticed that the two cache
variables of Color are a SmallInteger and a Bitmap.  The small integer
(bit depth) seems fine on the reconstituted object, but the Bitmap
(cachedBitPattern), which looks okay upon inspection in the inspector,
is just somehow foul when it came out of GOODS.

Bitmap is a variableWordSubclass and I know GOODs recently received
some attention in this area.  I can't suggest a test case other than
this long roundabout dialog that I provided.  I don't visually see any
difference in this bad bitmap vs. a good one so I can't tell you what
is wrong with it other than BitBlt doesn't like it the bad one that
looks fine, but something under the covers is going on.

I wish I could provide a suggestion or possible fix, but does anyone
have any ideas?

Regards,

John
-- 
Three failures denote uncommon strength. A weakling has not enough
grit to fail thrice. -- Minna Thomas Antrim



More information about the Squeak-dev mailing list