It is currently Sat Jul 06, 2024 8:28 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: please fix a script for me
PostPosted: Tue Sep 18, 2018 11:09 am  (#1) 
Offline
GimpChat Member

Joined: Sep 20, 2016
Posts: 293
I have this 'make 3d' script that i use a lot.
Unfortunately it has one little flaw: it never appears in the 'Filters -> Repeat Last' list.

Can somebody tell me what code i need to add to make it work ?

        (script-fu-register
                  "script-fu-make-3d"                        ;func name
                  "make-3d"                                  ;menu label
                  "Makes a 3D representation\
          of the current (text) layer"              ;description
                  "Frans Rijven"                             ;author
                  "copyright 2009, Frans Rijven"             ;copyright notice
                  "Aug 11 , 2009"                          ;date created
                  ""                     ;image type that the script works on
        SF-IMAGE      "Image"           0
        SF-DRAWABLE   "Drawable"        0
        SF-VALUE   "Depth"  "6"
        SF-OPTION "Horizontal direction" '("Right" "Neutral" "Left")
        SF-OPTION "Vertical direction" '("Bottom" "Neutral" "Top")
        SF-OPTION "Half depth" '("none" "horizontal" "vertical")
        SF-VALUE   "Bump-direction:"  "90"
        SF-VALUE   "Bump-height:"  "45"
        SF-VALUE   "Bump-projection depth:"  "2"
        )
        (script-fu-menu-register "script-fu-make-3d" "<Image>/Script-Fu")

        (define (script-fu-make-3d beeld laag diepte hrichting vrichting half brichting bhoogte bprojdiep)
      (gimp-image-undo-group-start beeld)
   (let*
      (
         (orglaag (car (gimp-image-get-active-layer beeld)))
      )
     (let*
      (
         (werklaag (car (gimp-layer-copy laag TRUE )))
         (pos (car (gimp-image-get-layer-position beeld laag)))
         (nwpos (+  pos 1))
        )
       (gimp-image-add-layer beeld werklaag nwpos)
     )
     (let*
       (
;         (nlaag 0)
         (baslaag (car (gimp-image-get-active-layer beeld)))
;        (baspos (car (gimp-image-get-layer-position beeld baslaag)))
         (lagenteller diepte)
        (focuslaag baslaag)
        (hwissel 0)
        (vwissel 0)
       )
        (set! hrichting (- 1 hrichting))
        (set! vrichting( - 1 vrichting))
        (set! hwissel hrichting)
        (set! vwissel vrichting)
         (plug-in-bump-map 1 beeld baslaag baslaag brichting bhoogte bprojdiep 0 0 0 0 TRUE FALSE 0)
        (while (> lagenteller 0)
           (let*
              (
              (focuslaag (car (gimp-image-get-active-layer beeld)))
               (werklaag (car (gimp-layer-copy focuslaag TRUE )))
               (laagpos (car (gimp-image-get-layer-position beeld focuslaag)))
              (nwpos (+ laagpos 1))
             )
            (if (= half 2)
               (if (= vwissel 0)
                  (set! vwissel vrichting)
                  (set! vwissel 0)
               )
            )
            (if (= half 1)
               (if (= hwissel 0)
                  (set! hwissel hrichting)
                  (set! hwissel 0)
               )
            )
             (gimp-image-add-layer beeld werklaag nwpos)
             (gimp-drawable-transform-2d-default werklaag 0 0 1 1 0 hwissel vwissel FALSE 0)
             (set! lagenteller (- lagenteller 1))
           )
        )
        (gimp-image-set-active-layer beeld baslaag)
        (set! lagenteller diepte)
        (while (> lagenteller 0)
           (gimp-image-merge-down beeld baslaag 0)
           (set! baslaag (car (gimp-image-get-active-layer beeld)))
           (set! lagenteller (- lagenteller 1))
        )
      (gimp-image-set-active-layer beeld orglaag)
      (gimp-displays-flush)
      (gimp-image-undo-group-end beeld)
     ) 
     )
   )


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: please fix a script for me
PostPosted: Tue Sep 18, 2018 1:44 pm  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
All I had to do was change image type to "RGB*"

        (define (script-fu-make-3d beeld laag diepte hrichting vrichting half brichting bhoogte bprojdiep)
      (gimp-image-undo-group-start beeld)
   (let*
      (
         (orglaag (car (gimp-image-get-active-layer beeld)))
      )
     (let*
      (
         (werklaag (car (gimp-layer-copy laag TRUE )))
         (pos (car (gimp-image-get-layer-position beeld laag)))
         (nwpos (+  pos 1))
        )
       (gimp-image-add-layer beeld werklaag nwpos)
     )
     (let*
       (
;         (nlaag 0)
         (baslaag (car (gimp-image-get-active-layer beeld)))
;        (baspos (car (gimp-image-get-layer-position beeld baslaag)))
         (lagenteller diepte)
        (focuslaag baslaag)
        (hwissel 0)
        (vwissel 0)
       )
        (set! hrichting (- 1 hrichting))
        (set! vrichting( - 1 vrichting))
        (set! hwissel hrichting)
        (set! vwissel vrichting)
         (plug-in-bump-map 1 beeld baslaag baslaag brichting bhoogte bprojdiep 0 0 0 0 TRUE FALSE 0)
        (while (> lagenteller 0)
           (let*
              (
              (focuslaag (car (gimp-image-get-active-layer beeld)))
               (werklaag (car (gimp-layer-copy focuslaag TRUE )))
               (laagpos (car (gimp-image-get-layer-position beeld focuslaag)))
              (nwpos (+ laagpos 1))
             )
            (if (= half 2)
               (if (= vwissel 0)
                  (set! vwissel vrichting)
                  (set! vwissel 0)
               )
            )
            (if (= half 1)
               (if (= hwissel 0)
                  (set! hwissel hrichting)
                  (set! hwissel 0)
               )
            )
             (gimp-image-add-layer beeld werklaag nwpos)
             (gimp-drawable-transform-2d-default werklaag 0 0 1 1 0 hwissel vwissel FALSE 0)
             (set! lagenteller (- lagenteller 1))
           )
        )
        (gimp-image-set-active-layer beeld baslaag)
        (set! lagenteller diepte)
        (while (> lagenteller 0)
           (gimp-image-merge-down beeld baslaag 0)
           (set! baslaag (car (gimp-image-get-active-layer beeld)))
           (set! lagenteller (- lagenteller 1))
        )
      (gimp-image-set-active-layer beeld orglaag)
      (gimp-displays-flush)
      (gimp-image-undo-group-end beeld)
     )
     )
   )
(script-fu-register
                  "script-fu-make-3d"                        ;func name
                  "make-3d"                                  ;menu label
                  "Makes a 3D representation\
          of the current (text) layer"              ;description
                  "Frans Rijven"                             ;author
                  "copyright 2009, Frans Rijven"             ;copyright notice
                  "Aug 11 , 2009"                          ;date created
                  "RGB*"                     ;image type that the script works on
        SF-IMAGE      "Image"           0
        SF-DRAWABLE   "Drawable"        0
        SF-VALUE   "Depth"  "6"
        SF-OPTION "Horizontal direction" '("Right" "Neutral" "Left")
        SF-OPTION "Vertical direction" '("Bottom" "Neutral" "Top")
        SF-OPTION "Half depth" '("none" "horizontal" "vertical")
        SF-VALUE   "Bump-direction:"  "90"
        SF-VALUE   "Bump-height:"  "45"
        SF-VALUE   "Bump-projection depth:"  "2"
        )
        (script-fu-menu-register "script-fu-make-3d" "<Image>/Script-Fu")

_________________
TinT


Top
 Post subject: Re: please fix a script for me
PostPosted: Tue Sep 18, 2018 1:47 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Quite a lot of time I do not use scheme.
One simple difference with respect to those I wrote in the past is that I always set the filter definition first and the filter registration afterwards, but this probably doesn't matter.
As Tin said, replace the null image type to something like RGB*.

_________________
"Where am I ?"


Top
 Post subject: Re: please fix a script for me
PostPosted: Tue Sep 18, 2018 2:04 pm  (#4) 
Offline
GimpChat Member

Joined: Sep 20, 2016
Posts: 293
trandoductin wrote:
All I had to do was change image type to "RGB*"

Oh, so easy :)

Thanks a lot trandoductin ! :yes


Top
 Post subject: Re: please fix a script for me
PostPosted: Tue Sep 18, 2018 2:19 pm  (#5) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
There is a better 3D script that even uses Texture, created by one of the Gimpchat member and former owner "GnuTux". The website is not up, but I can share this wonderful Filter with you.


Attachments:
Filters-3d-extrusion.scm [15.83 KiB]
Downloaded 148 times

_________________
https://www.deviantart.com/pocholo17
Image
Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Looking for Script Coder to make Script of my VHS effect

2

No new posts Attachment(s) A liitle Start Help with a Script-Fu Script

3

No new posts Attachment(s) Cannot run test script-fu script via console

7

No new posts Attachment(s) Script-fu

6

No new posts Attachment(s) Rotate Hue Script

74



* Login  



Powered by phpBB3 © phpBB Group