Wings 3D Development Forum

Full Version: Scripting with Scheme and Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
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
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.
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.
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
Really a nice addition.
Be able to preview the result is very important when we are exploring changes to the shape.
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....4#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?
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.
(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).
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]
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.
Pages: 1 2 3 4