This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-01-18 12:39:21

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

colour replace in Panther

I really need a way for a costume to have all of one colour cleared to show transparent background. If anyone has the block code it would be very helpful and save me a lot of time doing it by hand!

Last edited by sparks (2012-01-18 12:47:42)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2 2012-01-19 23:42:10

celloguy123
Scratcher
Registered: 2009-01-15
Posts: 100+

Re: colour replace in Panther

Maybe you could look in the coding of the paint editor (Scratch-Paint)? It may be there...


http://internetometer.com/image/33068.png

Offline

 

#3 2012-01-20 17:19:38

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: colour replace in Panther

I'm working on one; I almost have it.  Just a few minutes...

Offline

 

#4 2012-01-20 17:25:45

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

Greenatic wrote:

I'm working on one; I almost have it.  Just a few minutes...

Awesome! I can't wait to see it!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#5 2012-01-20 17:55:17

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: colour replace in Panther

sparks wrote:

Greenatic wrote:

I'm working on one; I almost have it.  Just a few minutes...

Awesome! I can't wait to see it!

I've got it replacing, but I can't figure out how to update the thumbnails...

...or the image on the Scratch window itself...but the form is updated.

Last edited by Greenatic (2012-01-20 18:27:31)

Offline

 

#6 2012-01-20 18:23:33

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

bummer... have you tried

stage changed.

? I've also seen:

viewerPane categoryChanged: 'variables'

which may be changeable or close to what you're looking for. I think it's about refreshing the right section.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2012-01-20 19:11:41

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: colour replace in Panther

sparks wrote:

bummer... have you tried

stage changed.

? I've also seen:

viewerPane categoryChanged: 'variables'

which may be changeable or close to what you're looking for. I think it's about refreshing the right section.

Never mind, I seem to have found it.  Please let me know of any glitches (and include this in the Block Library Panther update when you get a chance).  Please note: Colored text is not effected.

Stack block; Looks

Code:

clear color $Color$ from $Costumes$

Code:

| t3 t4 |
[media detect:[:t5| t5 asString = (t2, ' [image]')]] ifError:[^self].
t3 _ media detect:[:t5| t5 asString = (t2, ' [image]')].
[
(t3 form) replaceColor: t1 with: (Color transparent)] ifError:[^self].
(t3 form) replaceColor: t1 with: (Color transparent).
self changed.
(self ownerThatIsA: ScratchFrameMorph) ifNil: [^ self].
(((self ownerThatIsA: ScratchFrameMorph) findA: ScratchScriptEditorMorph) findA: ScratchThumbnailMorph) updateThumbnail.

(((self ownerThatIsA: ScratchFrameMorph) findA: ScratchScriptEditorMorph) findA: ScratchTabPaneMorph) ifNil:[^ self].
t4 _ 
(((self ownerThatIsA: ScratchFrameMorph) findA: ScratchScriptEditorMorph) findA: ScratchTabPaneMorph) currentTab.
(((self ownerThatIsA: ScratchFrameMorph) findA: ScratchScriptEditorMorph) findA: ScratchTabPaneMorph) currentTab: 'Costumes'.

(((self ownerThatIsA: ScratchFrameMorph) findA: ScratchScriptEditorMorph) findA: ScratchTabPaneMorph) currentTab: t4.

Last edited by Greenatic (2012-01-20 19:12:38)

Offline

 

#8 2012-01-21 02:45:02

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

Incredible! I love it!!!! Thanks very much, it's amazing what is possible with the custom blocks  tongue  I'll try and do a Panther update sometime soon, I know I've been neglecting it but I have so much other work!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#9 2012-01-21 03:02:30

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

I've just realised what else this could be used for... animations in Panther that are smaller than the stage... awesome!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#10 2012-01-22 12:03:21

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: colour replace in Panther

Glad you like it!   smile

Offline

 

#11 2012-02-06 11:14:54

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

strangely this doesn't seem to work anymore...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#12 2012-02-06 18:31:26

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: colour replace in Panther

sparks wrote:

strangely this doesn't seem to work anymore...

OK, that's odd...could a more experienced Squeaker help us out here?   hmm

Offline

 

#13 2012-02-07 16:47:35

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

Odd. It seems to be updating the actual costume atm whilst the icons in the sprite info bit and the sprites list bit as well as the actual sprite on the stage don't change until you [edit] the costume.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#14 2012-02-07 17:09:34

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

Another thing I've just noticed is that if you use the colour replace on the default Panther costume, it will stay like that until you close the window, creating a new project won't get rid of the changes!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#15 2012-02-07 17:32:13

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: colour replace in Panther

sparks wrote:

Odd. It seems to be updating the actual costume atm whilst the icons in the sprite info bit and the sprites list bit as well as the actual sprite on the stage don't change until you [edit] the costume.

That's what I spent so long trying to figure out how to fix.  Great.   sad

sparks wrote:

Another thing I've just noticed is that if you use the colour replace on the default Panther costume, it will stay like that until you close the window, creating a new project won't get rid of the changes!

Maybe it's got a problem with transparency?  I don't know...   sad

Offline

 

#16 2012-02-07 17:49:47

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: colour replace in Panther

Well the images I was trying to manipulate were stage shots with no transparency... its really confusing though,  swear it worked fine before.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#17 2012-02-07 17:57:32

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: colour replace in Panther

sparks wrote:

Well the images I was trying to manipulate were stage shots with no transparency... its really confusing though,  swear it worked fine before.

This seems to work as well on the current costume, but creates a new costume and messes with the size on the Scratch cat:

Code:

        (self form) mapColor: t1 to: Color transparent.
    self form: ((self form) copy: ((self form) rectangleEnclosingPixelsNotOfColor: Color transparent))

Last edited by Greenatic (2012-02-07 17:58:09)

Offline

 

Board footer