Wings 3D Development Forum
Scripting with Scheme and Python - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Design & Development (https://www.wings3d.com/forum/forumdisplay.php?fid=6)
+--- Thread: Scripting with Scheme and Python (/showthread.php?tid=3096)

Pages: 1 2 3 4


RE: Scripting with Scheme and Python - edb - 04-15-2023

Hello tkbd,
Thank you very much for trying the plugin and also making the how to for mac os, it will be very useful reference.

tkbd Wrote:Distorted scaling script plugin
It doesn't work,it returned error a following.
Oh there was a bug, I just fixed in a new update.

tkbd Wrote:but Some issue happend,so I report it to you.
Crash When interpreter pathes are wrong
This mean is Wings3d crash without error dialog.
I'll need to improve it for these scenarios.

tkbd Wrote:new_shape_pixel_art script plugin
Read to large size pgm(ppm)file(e.g. 256px*256px),
it slow down Wings3D and freeze at last.
It might need improvement on bigger mesh making. I've turned off some debug messages in the latest update (which can be re-enabled in settings) so the whole content of big meshes aren't output to log. There is also a 1 minute timeout in the message receive loop that might need to be adjustable.

New update to plugin:
wpc_scripting_shapes.tar

Updates to pack (two new color effects):
https://github.com/elblake/wings-scripts-pack


RE: Scripting with Scheme and Python - tkbd - 04-16-2023

Thank you very much for update!!
I tried your new version,then now Distorted Scaling works fine Smile

About new append plugins.
Color test command applied vertex color to 3D object surface by simple color projection.
Wavey Color command applied vertex gradation colors to 3D object surface by Color solid projection.
I enjoyed the gradation by changing to the material colors.

I'm looking forward to the future of Wings3D scripting plugins.


RE: Scripting with Scheme and Python - edb - 09-04-2023

I've added some functions to help with script timeouts so the scripts can run for as long as they need by sending occasional messages, as well the scripts can now provide updates on what it is doing in the progress bar.

New update to plugin:
wpc_scripting_shapes.tar

Updates to pack (added long running process function to heightmap_exporter.scm):
https://github.com/elblake/wings-scripts-pack

Also, not in this update yet, but I'm making an installation helper as an escript to help the user download and install python and gauche.


RE: Scripting with Scheme and Python - edb - 09-25-2023

Hello,

I've made some big updates to the scripting plugin. If you have made any scripts you will need to make a change to your script for it to work with this new plugin.

Scheme
For scheme you will need to wrap your code into an entry function and use (main-function entryfunction)

example:
Code:
...
...

(define (importer *params* *extra-params*)
    (define Filename (list-ref (assoc "filename" *extra-params*) 1))
    (import_fun '() Filename)
    )

(main-function importer)


Python
For python you will need to wrap your code into an entry function and use w3d_main_function = entryfunction

example:
Code:
...
...

def exporter(params, params_by_key, extra_params):
    filename = extra_params["filename"]
    content = w3d_e3d.E3DFile()
    content.load_from(extra_params["content"])
    export_fun({}, filename, content)

w3d_main_function = exporter


With this new update scripts can now show a preview:
[Image: YBlKz96t_o.gif]

There's also some other new updates:
  • Internationalization strings inside Scheme and Python source
  • Some adjustments to progress message functionality

New update to plugin:
wpc_scripting_shapes.tar

Updates to pack
https://github.com/elblake/wings-scripts-pack


RE: Scripting with Scheme and Python - micheus - 09-26-2023

Really a nice addition.
Be able to preview the result is very important when we are exploring changes to the shape.


RE: Scripting with Scheme and Python - ivla - 09-29-2023

Hi.

Windows 10 Pro 64-bit 22H2
User without administrative privileges.
Python 3.11.5 64-bit (added to PATH)
Gauche 0.9.12 64-bit (added to PATH)
Wings3d 2.2.9 with latest patches from here: http://www.wings3d.com/forum/showthread.php?tid=2728&pid=14154#pid14154
Plugin & scripts from your recent post (2023-09-26)
All script paths defined in plugin preferences and directory with scripts is writable for my user.

Any export script asks about parameters and w3d shows small window about "unknown POSIX error". No files created.
New shape script asks about parameters and nothing happens - no new objects on outliner, no error windows or messages in wings console.

What can be wrong?


RE: Scripting with Scheme and Python - edb - 09-30-2023

ivla Wrote:What can be wrong?
When a "unknown POSIX error" shows up usually it means it tried to run the interpreter but it couldn't be found.
What does your settings look like in Plug-in Preferences > Scripts Preference > Interpreters tab

Usually if the text boxes are empty it will try to figure it out automatically.


micheus Wrote:Be able to preview the result is very important when we are exploring changes to the shape.
Yup the preview helps a lot.


RE: Scripting with Scheme and Python - micheus - 09-30-2023

(09-30-2023, 06:11 PM)edb Wrote: Usually if the text boxes are empty it will try to figure it out automatically.
I think it try do that by checking some environment variable. If so, and the var was not set on Python install process then the error will persist. (just a side note for ivla).


RE: Scripting with Scheme and Python - ivla - 10-02-2023

Thanks for replies.

Both interpreters is in PATH - I can run it by typing "python" or "gosh" in command line.
I've got a try with its path in plugin preferences and without it.
Maybe I should do something else?
[Image: 001.png]


RE: Scripting with Scheme and Python - edb - 10-02-2023

ivla Wrote:Both interpreters is in PATH - I can run it by typing "python" or "gosh" in command line.
I've got a try with its path in plugin preferences and without it.
Maybe I should do something else?

Try the paths in the text boxes without double quotes.

So for example:

"C:\Program Files\...\python.exe"
changes to
C:\Program Files\...\python.exe

There shouldn't be any problems with spaces in the interpreter path.