Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Sculpt Sculpt_Texture_Export_Script  

Sculpt_Texture_Export_Script

Restart the GIMP after creating the file (or refresh the scripts with Xtns->Script-Fu->Refresh Scripts from the Tools window). A new menu item will appear in the Image window (Script-Fu->SecondLife->Export Sculptie). The script will prompt the user for a filename, and then will export the image as a mesh which can be uploaded into a 3D modelling tool.

Note that the script does not close off the top and bottom seams of the model the way SL does. Other than that the model will look very similar in a 3D tool as it does in SL.

Category: Sculpt
By : anonymous
Created: 2011-01-22 Edited: 2011-01-22
Worlds: Second Life

the Zip file

Download all files for Sculpt_Texture_Export_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Sculpt_Texture_Export_Script_for_th_1.lsl
1 (define (script-fu-exp-sculptie inImage inDrawable inFilename)
2 (define (putv x y z f)
3 (let* ((buf (string-append "v "
4 (number->string x) " "
5 (number->string y) " "
6 (number->string z) "\n")))
7 (puts buf f)
8 )
9 )
10 (define (v-num-str row col width) (number->string (+ (* row width) col 1)))
11 (define (decode x) (if(>= x 0) x (+ 256 x)))
12 (let*
13 (
14 (obj-file (fopen inFilename "w+"))
15 (iwidth (car (gimp-drawable-width inDrawable)))
16 (iheight (car (gimp-drawable-height inDrawable)))
17 (row 0)
18 )
19 (verbose 2)
20 (while(< row iheight)
21 (let* ((col 0))
22 (while(< col iwidth)
23 (let*
24 (
25 (pixel (cadr (gimp-drawable-get-pixel inDrawable col row)))
26 (x (/ (decode (aref pixel 0)) 255.0))
27 (y (/ (decode (aref pixel 1)) 255.0))
28 (z (/ (decode (aref pixel 2)) 255.0))
29 )
30 (putv x y z obj-file)
31 )
32 (set! col (+ col 1))
33 )
34 )
35 (set! row (+ row 1))
36 )
37 (set! row 0)
38 (while(< row (- iheight 1))
39 (let* ((col 0))
40 (while(< col iwidth)
41 (writes obj-file (string-append "f "
42 (v-num-str row col iwidth) " "
43 (v-num-str row (fmod (+ col 1) iwidth) iwidth) " "
44 (v-num-str (+ row 1) (fmod (+ col 1) iwidth) iwidth) " "
45 (v-num-str (+ row 1) col iwidth) "\n"))
46 (set! col (+ col 1))
47 )
48 )
49 (set! row (+ row 1))
50 )
51 (verbose 0)
52 (fclose obj-file)
53 )
54 )
55
56 (script-fu-register
57 "script-fu-exp-sculptie" ;func name
58 "Export Sculptie" ;menu label
59 "Exports the current image layer as a wavefront\
60 obj file." ;description
61 "Kris Kovacs" ;author
62 "copyright 2007, Kris Kovacs" ;copyright notice
63 "May 17, 2007" ;date created
64 "RGB*"
65 SF-IMAGE "Input Image" 0 ;image type that the script works on
66 SF-DRAWABLE "Input Drawable" 0 ;
67 SF-FILENAME "Output File:" "tmp.obj" ;a string variable
68 )
69 (script-fu-menu-register "script-fu-exp-sculptie" _"<Image>/Script-Fu/SecondLife")

Back to the Best Free Tools in Second Life and OpenSim.