From: FruitieX Date: Sat, 10 Jul 2010 23:49:47 +0000 (+0300) Subject: chatbubble sources X-Git-Tag: xonotic-v0.1.0preview~28^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5dcc896423b752dbe92134f019a0736db9cda6ed;p=xonotic%2Fmediasource.git chatbubble sources --- diff --git a/models/misc/chatbubble/chatbubble.blend b/models/misc/chatbubble/chatbubble.blend new file mode 100644 index 0000000..945fb80 Binary files /dev/null and b/models/misc/chatbubble/chatbubble.blend differ diff --git a/models/misc/chatbubble/create b/models/misc/chatbubble/create new file mode 100755 index 0000000..8f557c4 --- /dev/null +++ b/models/misc/chatbubble/create @@ -0,0 +1,24 @@ +#!/bin/bash +#Uses Blender, Inkscape, Gimp and ~/.gimp*/scripts/whiteborder.scm +#Renders the scene from this .blend file: +file=chatbubble + +#Export png from all svg files +for f in *.svg +do + inkscape -f "$f" -e "`basename $f .svg`.png" +done + +#Render single Blender scene +render_scene() +{ + blender -b "$PWD/$file.blend" -S "$scene" -o "//$scene#" -f 1 + rename "${scene}1" "$scene" "${scene}1".* +} + +#Render the Blender scene +scene=chatbubble +render_scene + +#Add white border +gimp -d -f -i -b '(whiteborder "chatbubble.tga" 1 5 12 0 4)' -b '(gimp-quit 0)' diff --git a/models/misc/chatbubble/keyface1.svg b/models/misc/chatbubble/keyface1.svg new file mode 100644 index 0000000..cd37abc --- /dev/null +++ b/models/misc/chatbubble/keyface1.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + X + + diff --git a/models/misc/chatbubble/keyface2.svg b/models/misc/chatbubble/keyface2.svg new file mode 100644 index 0000000..6400471 --- /dev/null +++ b/models/misc/chatbubble/keyface2.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + O + + diff --git a/models/misc/chatbubble/keyface3.svg b/models/misc/chatbubble/keyface3.svg new file mode 100644 index 0000000..0693985 --- /dev/null +++ b/models/misc/chatbubble/keyface3.svg @@ -0,0 +1,90 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + N + + diff --git a/models/misc/chatbubble/whiteborder.scm b/models/misc/chatbubble/whiteborder.scm new file mode 100644 index 0000000..9369ccf --- /dev/null +++ b/models/misc/chatbubble/whiteborder.scm @@ -0,0 +1,63 @@ +;Adds a white border and a faint glow, based on the alpha channel +;Input: filesIn (wildcard * possible) borderGrow borderFeather objectShrink objectFeather glowBlur +;Output: RLE compressed .tga file(s) (overwrites existing tga files) + +(define (whiteborder filesIn glowBlur borderGrow borderFeather objectShrink objectFeather) + (let* + ( + (fileList (cadr (file-glob filesIn 1))) + (borderColor '(255 255 255)) + (borderGlow '(223 223 223)) + ) + + (while (not (null? fileList)) + (let* + ( + (file (car fileList)) + (image (car (gimp-file-load 1 file file))) + (bottomLayer (car (gimp-image-get-active-layer image))) + (middleLayer (car (gimp-layer-new-from-drawable bottomLayer image))) + (topLayer (car (gimp-layer-new-from-drawable bottomLayer image))) + ) + + ;Add layers + (gimp-image-add-layer image middleLayer -1) + (gimp-image-add-layer image topLayer -1) + + ;Bottom layer: create extended glow siluette of the object + (gimp-context-set-foreground borderGlow) + (gimp-selection-layer-alpha bottomLayer) + (gimp-selection-grow image (- borderGrow 1)) + (gimp-selection-feather image borderFeather) + (gimp-edit-fill bottomLayer 0) + (gimp-selection-none image) + (plug-in-gauss-rle 1 image bottomLayer glowBlur 1 1) + + ;Middle layer: create extended siluette of the object + (gimp-context-set-foreground borderColor) + (gimp-selection-layer-alpha middleLayer) + (gimp-selection-grow image borderGrow) + (gimp-selection-feather image borderFeather) + (gimp-edit-fill middleLayer 0) + + ;Top layer: reduce border of the object on the top layer + (gimp-selection-layer-alpha topLayer) + (gimp-selection-shrink image objectShrink) + (gimp-selection-feather image objectFeather) + (gimp-selection-invert image) + (gimp-edit-clear topLayer) + + ;Set extension to .tga + (set! file (car (strbreakup file "."))) + (set! file (string-append file ".tga")) + + ;Save image as RLE compressed tga + (set! bottomLayer (car (gimp-image-merge-visible-layers image 1))) + (file-tga-save 1 image bottomLayer file file 1 0) + (gimp-image-delete image) + + (set! fileList (cdr fileList)) + ) + ) + ) +)