Skip to content

Commit af6e932

Browse files
committed
First release of the scripting plugin.
Added set_face_attr_vs/4 to wings_va which can set new attribute values from the list returned by face_attr/3. Added replace_attr/3 to wings_va. Added new config files. Fixes to some types of values passed to the script. More distinct use of vector vs list in returned script data. New preference dialog implemented with help from micheus. Scripts can now use checkboxes and dropdown lists for parameters in the simple parameter layout. Scripts can also specify advanced parameter layouts as erlang terms directly. A lot of changes made to the scripting plugin. Added manual code, documentation and tools, updated makefiles, added lang file, fixes. NOTE: Added scripting to wings.
1 parent 9c83104 commit af6e932

107 files changed

Lines changed: 9776 additions & 2755 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
# /plugins_src/autouv/
5151
/plugins_src/autouv/autouv_en.lang
5252

53+
# /plugins_src/scripting/docs/generated/
54+
/plugins_src/scripting/docs/generated/*
55+
5356
# /plugins_src/fbx/
5457
/plugins_src/fbx/*.o
5558
/plugins_src/fbx/*.obj
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory contains files for the scripting plugin.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory contains the python files for scripting.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory contains the scheme files for scripting.

plugins_src/scripting/Makefile

Lines changed: 67 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,18 @@ TYPE_FLAGS=
2828
endif
2929

3030
MODULES= \
31-
wpc_scripting_shapes
31+
wpc_scripting_shapes \
32+
scripting_engines
33+
34+
INIT_SCRIPT_SRC=$(ESRC)/init_scripts
35+
INIT_SCRIPT_EBIN=$(EBIN)/wpc_scripting_shapes_init
36+
INIT_SCRIPT_PY_SRC=$(INIT_SCRIPT_SRC)/py
37+
INIT_SCRIPT_PY_EBIN=$(INIT_SCRIPT_EBIN)/py
38+
INIT_SCRIPT_SCM_SRC=$(INIT_SCRIPT_SRC)/scm
39+
INIT_SCRIPT_SCM_EBIN=$(INIT_SCRIPT_EBIN)/scm
3240

3341
TARGET_FILES= $(MODULES:%=$(EBIN)/%.beam)
42+
3443

3544
# ----------------------------------------------------
3645
# FLAGS
@@ -51,40 +60,66 @@ lang: template
5160
cp *.lang $(EBIN)
5261
$(ERL) -pa $(WINGS_INTL) -noinput -run tools diff_lang_files $(EBIN)
5362

54-
common: $(TARGET_FILES)
63+
common: $(TARGET_FILES) $(INIT_SCRIPT_EBIN) subdirs
64+
65+
subdirs:
66+
(cd docs; $(MAKE))
5567

5668
clean:
5769
rm -f $(TARGET_FILES)
5870
rm -f core
71+
(cd docs; $(MAKE) clean)
72+
73+
ESCRIPT=escript
5974

60-
$(EBIN)/%.beam: $(ESRC)/%.erl $(EBIN)/wpc_scripting_shapes_init
75+
$(EBIN)/%.beam: $(ESRC)/%.erl
6176
$(ERLC) $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
62-
63-
$(EBIN)/wpc_scripting_shapes_init: $(EBIN)/wpc_scripting_shapes_init/init.py \
64-
$(EBIN)/wpc_scripting_shapes_init/w3d_e3d.py \
65-
$(EBIN)/wpc_scripting_shapes_init/w3d_int.py \
66-
$(EBIN)/wpc_scripting_shapes_init/w3d_newshape.py \
67-
$(EBIN)/wpc_scripting_shapes_init/init.scm \
68-
$(EBIN)/wpc_scripting_shapes_init/init_env_csi.scm \
69-
$(EBIN)/wpc_scripting_shapes_init/init_env_gauche.scm \
70-
71-
MKDIR_INIT_SCRIPTS=mkdir -p $(EBIN)/wpc_scripting_shapes_init/
72-
$(EBIN)/wpc_scripting_shapes_init/init.py: $(ESRC)/init_scripts/init.py
73-
$(MKDIR_INIT_SCRIPTS)
74-
cp $(ESRC)/init_scripts/init.py $(EBIN)/wpc_scripting_shapes_init/
75-
$(EBIN)/wpc_scripting_shapes_init/w3d_e3d.py: $(ESRC)/init_scripts/w3d_e3d.py
76-
cp $(ESRC)/init_scripts/w3d_e3d.py $(EBIN)/wpc_scripting_shapes_init/
77-
$(EBIN)/wpc_scripting_shapes_init/w3d_int.py: $(ESRC)/init_scripts/w3d_int.py
78-
cp $(ESRC)/init_scripts/w3d_int.py $(EBIN)/wpc_scripting_shapes_init/
79-
$(EBIN)/wpc_scripting_shapes_init/w3d_newshape.py: $(ESRC)/init_scripts/w3d_newshape.py
80-
cp $(ESRC)/init_scripts/w3d_newshape.py $(EBIN)/wpc_scripting_shapes_init/
81-
82-
$(EBIN)/wpc_scripting_shapes_init/init.scm: $(ESRC)/init_scripts/init.scm
83-
cp $(ESRC)/init_scripts/init.scm $(EBIN)/wpc_scripting_shapes_init/
84-
$(EBIN)/wpc_scripting_shapes_init/init_env_csi.scm: $(ESRC)/init_scripts/init_env_csi.scm
85-
cp $(ESRC)/init_scripts/init_env_csi.scm $(EBIN)/wpc_scripting_shapes_init/
86-
$(EBIN)/wpc_scripting_shapes_init/init_env_gauche.scm: $(ESRC)/init_scripts/init_env_gauche.scm
87-
cp $(ESRC)/init_scripts/init_env_gauche.scm $(EBIN)/wpc_scripting_shapes_init/
88-
89-
90-
#$(EBIN)/wpc_scripting_shapes.beam: $(WINGS_E3D)/e3d.hrl
77+
78+
PY_FILES= init w3d_e3d w3d_int w3d_newshape
79+
PY_FILES_1=$(PY_FILES:%=$(INIT_SCRIPT_PY_EBIN)/%.py)
80+
81+
SCM_FILES= init_env_csi init_env_gauche
82+
SCM_FILES_1=$(SCM_FILES:%=$(INIT_SCRIPT_SCM_EBIN)/%.scm)
83+
84+
$(INIT_SCRIPT_EBIN): $(INIT_SCRIPT_EBIN)/callable.conf \
85+
$(INIT_SCRIPT_EBIN)/defaults.conf \
86+
$(INIT_SCRIPT_EBIN)/python.script-init-conf \
87+
$(INIT_SCRIPT_EBIN)/scheme.script-init-conf \
88+
$(INIT_SCRIPT_PY_EBIN)/w3d_we.py \
89+
$(INIT_SCRIPT_SCM_EBIN)/init.scm \
90+
$(PY_FILES_1) \
91+
$(SCM_FILES_1)
92+
93+
94+
$(INIT_SCRIPT_EBIN)/%.conf: $(INIT_SCRIPT_SRC)/%.conf
95+
cp $< $(INIT_SCRIPT_EBIN)/
96+
$(INIT_SCRIPT_EBIN)/%.script-init-conf: $(INIT_SCRIPT_SRC)/%.script-init-conf
97+
cp $< $(INIT_SCRIPT_EBIN)/
98+
$(INIT_SCRIPT_PY_EBIN)/%.py: $(INIT_SCRIPT_PY_SRC)/%.py
99+
cp $< $(INIT_SCRIPT_PY_EBIN)/
100+
$(INIT_SCRIPT_SCM_EBIN)/%.scm: $(INIT_SCRIPT_SCM_SRC)/%.scm
101+
cp $< $(INIT_SCRIPT_SCM_EBIN)/
102+
103+
# Generate w3d_we.py file from callable.conf
104+
$(INIT_SCRIPT_PY_EBIN)/w3d_we.py: $(INIT_SCRIPT_PY_SRC)/w3d_we.1.py \
105+
$(INIT_SCRIPT_SRC)/callable.conf \
106+
$(INIT_SCRIPT_SRC)/py-modnames
107+
./tools/gen-init-we-script.sh \
108+
"$(INIT_SCRIPT_PY_SRC)/w3d_we.1.py" \
109+
- \
110+
"$(INIT_SCRIPT_SRC)/callable.conf" \
111+
"$(INIT_SCRIPT_SRC)/py-modnames" py \
112+
> "$(INIT_SCRIPT_PY_EBIN)/w3d_we.py"
113+
114+
# Generate init.scm file from callable.conf
115+
$(INIT_SCRIPT_SCM_EBIN)/init.scm: $(INIT_SCRIPT_SCM_SRC)/init.1.scm \
116+
$(INIT_SCRIPT_SRC)/callable.conf \
117+
$(INIT_SCRIPT_SRC)/scm-modnames \
118+
$(INIT_SCRIPT_SCM_SRC)/init.2.scm
119+
./tools/gen-init-we-script.sh \
120+
"$(INIT_SCRIPT_SCM_SRC)/init.1.scm" \
121+
"$(INIT_SCRIPT_SCM_SRC)/init.2.scm" \
122+
"$(INIT_SCRIPT_SRC)/callable.conf" \
123+
"$(INIT_SCRIPT_SRC)/scm-modnames" scm \
124+
> "$(INIT_SCRIPT_SCM_EBIN)/init.scm"
125+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#
2+
# Makefile --
3+
#
4+
# Makefile for building scripting documentation
5+
#
6+
# Copyright (c) 2025 Edward Blake
7+
#
8+
# See the file "license.terms" for information on usage and redistribution
9+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10+
#
11+
12+
AWK=awk
13+
MKDIR=mkdir -p
14+
PACK_MANUAL=../../../tools/pack_manual
15+
16+
FILES= \
17+
en/INDEX \
18+
en/README.txt \
19+
en/wscr/intro.txt \
20+
en/wscr/langfiles.txt \
21+
en/wscr/pluginscripts.txt \
22+
en/wscr/query.txt \
23+
en/wscr/scriptfolders.txt \
24+
en/wscr/directives/type.txt \
25+
en/wscr/directives/name.txt \
26+
en/wscr/directives/mode.txt \
27+
en/wscr/directives/desc.txt \
28+
en/wscr/directives/include.txt \
29+
en/wscr/directives/params_title.txt \
30+
en/wscr/directives/params_templates.txt \
31+
en/wscr/directives/template.txt \
32+
en/wscr/directives/params.txt \
33+
en/wscr/directives/param.txt \
34+
en/wscr/directives/extensions.txt \
35+
en/wscr/directives/params_init.txt \
36+
en/wscr/directives/params_set.txt \
37+
en/wscr/directives/export_param.txt \
38+
en/wscr/directives/import_param.txt \
39+
en/wscr/directives/adv_param.txt \
40+
en/wscr/directives/params_preview.txt \
41+
en/wscr/directives/command_changes.txt \
42+
en/wscr/directives/command_inputs.txt \
43+
en/wscr/directives/extra_file.txt \
44+
en/wscr/directives/script_param.txt \
45+
en/wscr/directives/hradio.txt \
46+
en/wscr/directives/menu.txt \
47+
en/wscr/directives/browse.txt \
48+
en/wscr/directives/checkbox.txt \
49+
en/wscr/directives/vradio.txt \
50+
en/scheme/command_scripts.txt \
51+
en/scheme/exporter_scripts.txt \
52+
en/scheme/importer_scripts.txt \
53+
en/scheme/intro.txt \
54+
en/scheme/langres.txt \
55+
en/scheme/new_shape_scripts.txt \
56+
en/scheme/functions/e3d_face.txt \
57+
en/scheme/functions/e3d_file.txt \
58+
en/scheme/functions/e3d_image.txt \
59+
en/scheme/functions/e3d_mesh.txt \
60+
en/scheme/functions/e3d_object.txt \
61+
en/python/command_scripts.txt \
62+
en/python/exporter_scripts.txt \
63+
en/python/importer_scripts.txt \
64+
en/python/intro.txt \
65+
en/python/langres.txt \
66+
en/python/new_shape_scripts.txt \
67+
en/python/functions/e3d_face.txt \
68+
en/python/functions/e3d_file.txt \
69+
en/python/functions/e3d_image.txt \
70+
en/python/functions/e3d_mesh.txt \
71+
en/python/functions/e3d_object.txt \
72+
en/python/functions/list_of_arrays.txt \
73+
en/python/functions/list_of_tuples.txt \
74+
en/python/functions/material.txt \
75+
en/python/functions/material_maps.txt \
76+
en/python/functions/material_opengl.txt \
77+
en/python/functions/new_shape.txt \
78+
en/python/functions/output_list.txt
79+
80+
SCRIPTINITDIR=../../../plugins/scripting/wpc_scripting_shapes_init
81+
82+
all: ${SCRIPTINITDIR}/scripting-reference-en.manual
83+
84+
clean:
85+
rm generated/en/scm-we.txt
86+
rm generated/en/py-we.txt
87+
rmdir generated/en
88+
rmdir generated
89+
90+
91+
generated/en:
92+
$(MKDIR) generated/en
93+
94+
generated/en/scm-we.txt: generated/en funs
95+
$(AWK) -v type=scm -f ../tools/gen-funs-doc.awk < funs > generated/en/scm-we.txt
96+
97+
generated/en/py-we.txt: generated/en funs
98+
$(AWK) -v type=py -f ../tools/gen-funs-doc.awk < funs > generated/en/py-we.txt
99+
100+
${SCRIPTINITDIR}/scripting-reference-en.manual: $(FILES) \
101+
generated/en/scm-we.txt \
102+
generated/en/py-we.txt
103+
$(PACK_MANUAL) en \
104+
--out ${SCRIPTINITDIR}/scripting-reference-en.manual
105+
106+
107+
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{info,[
2+
{title, "Scripting Reference"},
3+
{language, "en"}
4+
]}.
5+
{txt, "README", "README.txt"}.
6+
{"Scripting Information",[
7+
{"Introduction",[
8+
{txt, "Introduction", "wscr/intro.txt"},
9+
{txt, "Script Folders", "wscr/scriptfolders.txt"},
10+
{txt, "Plugin Scripts", "wscr/pluginscripts.txt"},
11+
{txt, "Language files", "wscr/langfiles.txt"},
12+
{txt, "Query Mini Language", "wscr/query.txt"}
13+
]},
14+
{"Directive Reference",[
15+
{txt, "type Directive", "wscr/directives/type.txt"},
16+
{txt, "name Directive", "wscr/directives/name.txt"},
17+
{txt, "mode Directive", "wscr/directives/mode.txt"},
18+
{txt, "desc Directive", "wscr/directives/desc.txt"},
19+
{txt, "include Directive", "wscr/directives/include.txt"},
20+
{txt, "params_title Directive", "wscr/directives/params_title.txt"},
21+
{txt, "params_templates Directive", "wscr/directives/params_templates.txt"},
22+
{txt, "template Directive", "wscr/directives/template.txt"},
23+
{txt, "params Directive", "wscr/directives/params.txt"},
24+
{txt, "param Directive", "wscr/directives/param.txt"},
25+
{txt, "extensions Directive", "wscr/directives/extensions.txt"},
26+
{txt, "params_init Directive", "wscr/directives/params_init.txt"},
27+
{txt, "params_set Directive", "wscr/directives/params_set.txt"},
28+
{txt, "export_param Directive", "wscr/directives/export_param.txt"},
29+
{txt, "import_param Directive", "wscr/directives/import_param.txt"},
30+
{txt, "adv_param Directive", "wscr/directives/adv_param.txt"},
31+
{txt, "params_preview Directive", "wscr/directives/params_preview.txt"},
32+
{txt, "script_param Directive", "wscr/directives/script_param.txt"},
33+
{txt, "extra_file Directive", "wscr/directives/extra_file.txt"},
34+
{txt, "command_inputs Directive", "wscr/directives/command_inputs.txt"},
35+
{txt, "command_changes Directive", "wscr/directives/command_changes.txt"},
36+
{txt, "hradio Directive", "wscr/directives/hradio.txt"},
37+
{txt, "menu Directive", "wscr/directives/menu.txt"},
38+
{txt, "browse Directive", "wscr/directives/browse.txt"},
39+
{txt, "checkbox Directive", "wscr/directives/checkbox.txt"},
40+
{txt, "vradio Directive", "wscr/directives/vradio.txt"}
41+
]}
42+
]}.
43+
{"Python",[
44+
{"Introduction",[
45+
{txt, "Online Resources for the Python Language", "python/langres.txt"},
46+
{txt, "Python Intro", "python/intro.txt"},
47+
{txt, "New Shape Scripts", "python/new_shape_scripts.txt"},
48+
{txt, "Command Scripts", "python/command_scripts.txt"},
49+
{txt, "Importer Scripts", "python/importer_scripts.txt"},
50+
{txt, "Exporter Scripts", "python/exporter_scripts.txt"}
51+
]},
52+
{"OutputList Function Reference",[
53+
{txt, "OutputList", "python/functions/output_list.txt"}
54+
]},
55+
{"NewShape (w3d_newshape) Function Reference",[
56+
{txt, "ListOfArrays", "python/functions/list_of_arrays.txt"},
57+
{txt, "ListOfTuples", "python/functions/list_of_tuples.txt"},
58+
{txt, "NewShape", "python/functions/new_shape.txt"}
59+
]},
60+
{"E3D (w3d_e3d) Function Reference",[
61+
{txt, "E3DFace", "python/functions/e3d_face.txt"},
62+
{txt, "E3DMesh", "python/functions/e3d_mesh.txt"},
63+
{txt, "E3DObject", "python/functions/e3d_object.txt"},
64+
{txt, "E3DImage", "python/functions/e3d_image.txt"},
65+
{txt, "MaterialMaps", "python/functions/material_maps.txt"},
66+
{txt, "MaterialOpenGLAttributes", "python/functions/material_opengl.txt"},
67+
{txt, "Material", "python/functions/material.txt"},
68+
{txt, "E3DFile", "python/functions/e3d_file.txt"}
69+
]},
70+
{"We (w3d_we) Function Reference",[
71+
{txt, "we", "../generated/en/py-we.txt"}
72+
]}
73+
]}.
74+
{"Scheme",[
75+
{"Introduction",[
76+
{txt, "Online Resources for the Scheme Language", "scheme/langres.txt"},
77+
{txt, "Scheme Intro", "scheme/intro.txt"},
78+
{txt, "New Shape Scripts", "scheme/new_shape_scripts.txt"},
79+
{txt, "Command Scripts", "scheme/command_scripts.txt"},
80+
{txt, "Importer Scripts", "scheme/importer_scripts.txt"},
81+
{txt, "Exporter Scripts", "scheme/exporter_scripts.txt"}
82+
]},
83+
{"E3D Function Reference",[
84+
{txt, "e3d_face", "scheme/functions/e3d_face.txt"},
85+
{txt, "e3d_mesh", "scheme/functions/e3d_mesh.txt"},
86+
{txt, "e3d_object", "scheme/functions/e3d_object.txt"},
87+
{txt, "e3d_file", "scheme/functions/e3d_file.txt"},
88+
{txt, "e3d_image", "scheme/functions/e3d_image.txt"}
89+
]},
90+
{"We Function Reference",[
91+
{txt, "we", "../generated/en/scm-we.txt"}
92+
]}
93+
]}.
94+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Scripting Plugin for Wings3D
2+
3+
This reference contains three sections:
4+
5+
Script Information (.wscr)
6+
7+
Scheme Scripting
8+
9+
Python Scripting
10+
11+
12+
CONTRIBUTORS FOR DOCUMENTATION
13+
14+
Edward Blake has written the documentation for the first
15+
release of the scripting plugin.
16+
17+
18+

0 commit comments

Comments
 (0)