You are here

Sculptie

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

(define (script-fu-exp-sculptie inImage inDrawable inFilename)
(define (putv x y z f)
(let* ((buf (string-append "v "
(number->string x) " "
(number->string y) " "
(number->string z) "\n")))
(puts buf f)
)
)
(define (v-num-str row col width) (number->string (+ (* row width) col 1)))
(define (decode x) (if (>= x 0) x (+ 256 x)))
(let*
(
(obj-file (fopen inFilename "w+"))
(iwidth (car (gimp-drawable-width inDrawable)))
(iheight (car (gimp-drawable-height inDrawable)))
(row 0)
)
(verbose 2)
(while (< row iheight)
(let* ((col 0))
(while (< col iwidth)
(let*
(
(pixel (cadr (gimp-drawable-get-pixel inDrawable col row)))
(x (/ (decode (aref pixel 0)) 255.0))
(y (/ (decode (aref pixel 1)) 255.0))
(z (/ (decode (aref pixel 2)) 255.0))
)
(putv x y z obj-file)
)
(set! col (+ col 1))
)
)
(set! row (+ row 1))
)
(set! row 0)
(while (< row (- iheight 1))
(let* ((col 0))
(while (< col iwidth)
(writes obj-file (string-append "f "
(v-num-str row col iwidth) " "
(v-num-str row (fmod (+ col 1) iwidth) iwidth) " "
(v-num-str (+ row 1) (fmod (+ col 1) iwidth) iwidth) " "
(v-num-str (+ row 1) col iwidth) "\n"))
(set! col (+ col 1))
)
)
(set! row (+ row 1))
)
(verbose 0)
(fclose obj-file)
)
)

(script-fu-register
"script-fu-exp-sculptie" ;func name
"Export Sculptie" ;menu label
"Exports the current image layer as a wavefront\
obj file." ;description
"Kris Kovacs" ;author
"copyright 2007, Kris Kovacs" ;copyright notice
"May 17, 2007" ;date created
"RGB*"
SF-IMAGE "Input Image" 0 ;image type that the script works on
SF-DRAWABLE "Input Drawable" 0 ;
SF-FILENAME "Output File:" "tmp.obj" ;a string variable
)
(script-fu-menu-register "script-fu-exp-sculptie" _"/Script-Fu/SecondLife")

Tags: 
GIMP Version: 

Comments

You have a weird way to post script. Usually in the post there is a descrition of what the script or plugin should do, often with links to examples , then the script itself is posted as "Attachment". I see another problem the license, as you posted nobody may distribute , and maybe not even use your script legally To avoid that you should refer to GPL or equivalent license (or at least state explicitly that you allow free use of the script, frre distribution and that the script may be edited) Then you chose gimp2.4 tag is your script incompatible with the last stable version that is 2.6 ..or is the tag to be wrong?
Subscribe to Comments for "Sculptie"