|
DeleD Community Edition Forums
|
View previous topic :: View next topic |
Author |
Message |
paul_nicholls DeleD PRO user
Joined: 05 Dec 2007 Posts: 356 Location: Hobart, Tasmania, Australia
|
Posted: Sun Feb 28, 2010 10:39 pm Post subject: Add Scripting Environment discussion. |
|
|
Re: tracker item "Add scripting environment" (2934570):
https://sourceforge.net/tracker/index.php?func=detail&aid=2934750&group_id=293758&atid=1241130
So people know, I have started adding in scripting support using Rem Object's Pascal Script.
I chose Pascal Script as I figured that DeleD is written in Delphi/Pascal, so the scripts should be too...
I have got a working script IDE where you can create, open, save and execute script files (included in source).
This is accessable via a new Tools/Scripting IDE menu item (currently set to invisible in the repository).
I am now working on the functionality that can be accessed via the scripts.
If anyone has any concerns, hints, questions, or even ideas about this subject, feel free to post here
cheers,
Paul _________________ Long live DeleD!
Hi ho...hi ho...it's off 3d modeling I go... |
|
Back to top |
|
|
chronozphere DeleD PRO user
Joined: 20 Jun 2006 Posts: 1010 Location: Netherlands
|
Posted: Tue Mar 23, 2010 11:07 pm Post subject: |
|
|
Hi paul,
Any progress on this one? |
|
Back to top |
|
|
paul_nicholls DeleD PRO user
Joined: 05 Dec 2007 Posts: 356 Location: Hobart, Tasmania, Australia
|
Posted: Wed Mar 24, 2010 12:18 am Post subject: |
|
|
chronozphere wrote: |
Hi paul,
Any progress on this one? |
Not lately, I have been 'sidetracked' by stuff...
Now that I think of it, I have a question for you too, actually
When running a script, do you think I should make the script dialog box close down?
If I don't, sometimes it becomes hidden behind DeleD, thus making the program completely unresponsive...this is probably because I refresh DeleD views behind the scenes.
I don't know how to fix this issue...I've tried a modal dialog box (current version), and a non-modal dialog box too.
cheers,
Paul _________________ Long live DeleD!
Hi ho...hi ho...it's off 3d modeling I go... |
|
Back to top |
|
|
trucker2000 DeleD PRO user
Joined: 11 May 2005 Posts: 1839 Location: Sacramento, California
|
Posted: Wed Mar 24, 2010 3:04 am Post subject: |
|
|
My question is...Why would you want to run scripts in DeleD?
Placing script commands for use in a game engine is as simple as putting the command in the tag line and making an exporter that keeps it. _________________ Some day I will grow up and be a real modeler.
"Never give up! Never surrender!!"
Sys specs:
asus
8 gigs ram
Invidia gtx560 video card
Windows 8 (worst op sys Ever) |
|
Back to top |
|
|
paul_nicholls DeleD PRO user
Joined: 05 Dec 2007 Posts: 356 Location: Hobart, Tasmania, Australia
|
Posted: Wed Mar 24, 2010 3:32 am Post subject: |
|
|
trucker2000 wrote: |
My question is...Why would you want to run scripts in DeleD?
Placing script commands for use in a game engine is as simple as putting the command in the tag line and making an exporter that keeps it. |
I'm not talking about game scripting, but scripting that will extend DeleD by adding handy functionality via a scripting language (Pascal, Lua, etc.).
Here is an example script that I got working with my Lua DeleD scripting plugin (see this thread for the details: http://www.delgine.com/forum/viewtopic.php?t=3743):
Code: |
function Execute()
-- Icosahedron data
X = 0.525731112119133606
Z = 0.850650808352039932
ICOS_Vertices = {
{-X, 0.0, Z,1}, {X, 0.0, Z,1}, {-X, 0.0, -Z,1}, {X, 0.0, -Z,1},
{0.0, Z, X,1}, {0.0, Z, -X,1}, {0.0, -Z, X,1}, {0.0, -Z, -X,1},
{Z, X, 0.0,1}, {-Z, X, 0.0,1}, {Z, -X, 0.0,1}, {-Z, -X, 0.0,1}
}
ICOS_Indices = {
{0,4,1}, {0,9,4}, {9,5,4}, {4,5,8}, {4,8,1},
{8,10,1}, {8,3,10},{5,3,8}, {5,2,3}, {2,7,3},
{7,10,3}, {7,6,10}, {7,11,6}, {11,0,6}, {0,1,6},
{6,1,10}, {9,0,11}, {9,11,2}, {9,2,5}, {7,2,11}
}
Scene = DeleD.GetCurrentScene()
math.randomseed(100)
for p = 1,10 do
prim = Scene.AddPrimitive()
-- add vertices
for i = 1,12 do
x = ICOS_Vertices[i][1]
y = ICOS_Vertices[i][2]
z = ICOS_Vertices[i][3]
prim.AddVertex(x,y,z)
end
-- add polygons using vertex indices
for i = 1,20 do
i1 = ICOS_Indices[i][1]
i2 = ICOS_Indices[i][2]
i3 = ICOS_Indices[i][3]
prim.AddPolygonIndices(i1,i2,i3)
end
prim.Scale(math.random(50,200))
prim.Translate(math.random(-500,500),0,math.random(-500,500))
prim.SendToDeleD()
end
end |
That code produced this scene:
I want to add similar capabilities into DeleD without a plugin, but as a built-in scripting IDE (partly done)
I envisage that one could make almost complete scenes using a scripting language and save on heaps of modelling time
I hope this makes it clearer?
cheers,
Paul _________________ Long live DeleD!
Hi ho...hi ho...it's off 3d modeling I go... |
|
Back to top |
|
|
chronozphere DeleD PRO user
Joined: 20 Jun 2006 Posts: 1010 Location: Netherlands
|
Posted: Wed Mar 24, 2010 9:19 am Post subject: |
|
|
Hi, paul
I think there must be some kind of "always on top" option which you can enable for your window. You can still use DeleD while that window is open. You just have to move it to the side.
Also, please make sure you keep the scripting code as separated as possible from the rest of the code (for example, geometry code). This will make code maintainance 100x easier. I'm saying this because the scripting IDE may need access to a lot of data in DeleD. if we ever want to change/refactor something, we don't want to refactor the whole scripting feature aswell.
I thought i should point that out.
Good luck. Hope to see more. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|