[Modpack] WorldEdit [worldedit]

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

Guest2: yes, I'm currently in the process of doing exactly that. It's coming along pretty nicely right now. The structure is a bit simpler though, with an API mod, a chat interface mod, and the future Multinode interface for those familiar with that mod.

cornernote: you mean processing the nodes in batches? That could definitely work, though what I think jordan4ibanez meant was that for loops are faster than while loops. Some research tells me that this seems to be true, so I will be investigating that pretty soon.

Offtopic: I've committed your T-FF changes cornernote, but I will need to wait until tomorrow or the day after to push.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

i don't think the speed of the loop impacts performance. Its only looping a few thousand times at most. to highlight this, run the loop, but comment out the code that adds the node.

I think the performance hit is when the node has to be added to the world (a few thousand nodes at once).
Last edited by cornernote on Mon Oct 08, 2012 03:46, edited 1 time in total.

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

My tests indicate that for loops indeed have no noticable performance impact on the WorldEdit API. In fact, it seems a bit slower than the current one.

I guess that means we'll keep it the way it is, then.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

Update:
  • Chat command interface has been split off of the main WorldEdit API. The WorldEdit API is in the "worldedit" mod, and the chat commands are in the "worldedit_commands" mod.
  • New visualization functions and commands: //hide, //suppress, //find, and //restore all work with nodes non-destructively, so you can peek inside your Mesecon monstrosity and find that one node you're looking for. Also accessible from the WorldEdit API! For maximum ease of use, metadata is supported right out of the box.
  • Everything is documented in relevant categories, and the WorldEdit API and chat commands get their own files.
Grab the latest version from the GitHub download! It's fully backwards compatible with the previous version, although external mods such as worldedit_gui may not be updated yet.
Last edited by Temperest on Sun Oct 14, 2012 02:01, edited 1 time in total.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

Nice! Are the Visualization commands the only new things? I assume no other API command syntax changed.

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

Yep, the chat command interface is fully backwards compatible, while the API has been backwards compatible except for one early release that changed deserialization behavior along with the new WE file format.

I've given a shot at updating your worldedit_gui mod, but didn't have much luck. I might look into it more tomorrow.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

User avatar
Pythagoras
Member
Posts: 14
Joined: Mon Nov 05, 2012 00:29
Location: Vienna

by Pythagoras » Post

it may be a nice idea if someone could create some kind of schematics gallery where everyone can upload and get templates of different kind. this could be pretty much complementary to the primitives.

maybe i have some time to code that, but there could be a person with more time who is waiting for this very idea ;).

Comp52
Member
Posts: 56
Joined: Sun Oct 07, 2012 00:49

by Comp52 » Post

does anyone have the worldedit GUI? the thread doesn't have a working download link, and I really hate having to use chat commands so much.

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

I'm working on rewriting it - in the future it will be included with WorldEdit itself. I've already obtained permission from cornernote to use inventory_plus in the mod pack.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

Smitje
Member
Posts: 22
Joined: Wed Nov 14, 2012 20:42

by Smitje » Post

O no rotate messed up my lovely tower.

//rotate y 90
Image

Image

It looks like random blocks were moved, blocks allso ended up completely outside the region i selected.
Dont worry about the tower I have a .we backup.

Is there anything I can do to help find out what was wrong?
(I have a backup of the world in its curent state if you want to analyse. I am afraid I did try to rotate back whitch made it worse)

I used ¨Uberi-MineTest-WorldEdit-426dfb0¨ downloaded today
Minetest version ¨minetestc55_201211041952-0~1730~precise1_amd64¨ but it says 0.4.3 on the screen in the game is that normal?

[EDIT] More experiments show the problem may be in the transpose function. I will attempt to sort it out. [END EDIT]

[EDIT 2]
hurrah! It apears there was a small error in the transpose function. I changed 1 line and now it works as expected for me. Please verrify that it now works as intended, and update.

Code: Select all

--transposes a region defined by the positions `pos1` and `pos2` between the `axis1` and `axis2` axes, returning the number of nodes transposed
worldedit.transpose = function(pos1, pos2, axis1, axis2)
    local pos1, pos2 = worldedit.sort_pos(pos1, pos2)

    local pos = {x=pos1.x, y=0, z=0}
    local env = minetest.env
    while pos.x <= pos2.x do
        pos.y = pos1.y
        while pos.y <= pos2.y do
            pos.z = pos1.z
            while pos.z <= pos2.z do
                local extent1, extent2 = pos[axis1] - pos1[axis1], pos[axis2] - pos1[axis2]
                if extent1 < extent2 then
                    local node1 = env:get_node(pos)
                    local meta1 = env:get_meta(pos):to_table()
                    local value1, value2 = pos[axis1], pos[axis2]
                    pos[axis1], pos[axis2] = pos1[axis1] + extent2, pos1[axis2] + extent1 --This line changed
                    local node2 = env:get_node(pos)
                    local meta2 = env:get_meta(pos):to_table()
                    env:add_node(pos, node1)
                    env:get_meta(pos):from_table(meta1)
                    pos[axis1], pos[axis2] = value1, value2
                    env:add_node(pos, node2)
                    env:get_meta(pos):from_table(meta2)
                end
                pos.z = pos.z + 1
            end
            pos.y = pos.y + 1
        end
        pos.x = pos.x + 1
    end
    return worldedit.volume(pos1, pos2)
end

[END EDIT 2]

[EDIT 3]
There is still an isue left. transpose works if the selected area is square or longer in 1 direction but if it is longer in the other direction nothing happens
[END EDIT 3]



Cheers Smitje
Last edited by Smitje on Thu Nov 15, 2012 21:10, edited 1 time in total.

Smitje
Member
Posts: 22
Joined: Wed Nov 14, 2012 20:42

by Smitje » Post

Did some experiments.
I think the code below is correct now, however I am not sure the rotations still go in the right direction. As far as I can tell objects are not broken up any more no mater if the length or the width is larger.
only some minor changes to rotate and transpose are required (they are marked below)
please verify this works as intended before using it.

cheers Smitje

Code: Select all

--transposes a region defined by the positions `pos1` and `pos2` between the `axis1` and `axis2` axes, returning the number of nodes transposed
worldedit.transpose = function(pos1, pos2, axis1, axis2)
    local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
    if pos2[axis1]-pos1[axis1] >= pos2[axis2]-pos1[axis2] then --new
        largerOrSmaler = function(n1, n2) return n1 > n2 end    --new
    else                                                        --new
        largerOrSmaler = function(n1, n2) return n1 < n2 end    --new
    end                                                            --new
    

    local pos = {x=pos1.x, y=0, z=0}
    local env = minetest.env

    while pos.x <= pos2.x do
        pos.y = pos1.y
        while pos.y <= pos2.y do
            pos.z = pos1.z
            while pos.z <= pos2.z do
                local extent1, extent2 = pos[axis1] - pos1[axis1], pos[axis2] - pos1[axis2]
                if largerOrSmaler(extent1, extent2) then --changed
                    local node1 = env:get_node(pos)
                    local meta1 = env:get_meta(pos):to_table()
                    local value1, value2 = pos[axis1], pos[axis2]
                    pos[axis1], pos[axis2] = pos1[axis1] + extent2, pos1[axis2] + extent1 --This line changed
                    local node2 = env:get_node(pos)
                    local meta2 = env:get_meta(pos):to_table()
                    env:add_node(pos, node1)
                    env:get_meta(pos):from_table(meta1)
                    pos[axis1], pos[axis2] = value1, value2
                    env:add_node(pos, node2)
                    env:get_meta(pos):from_table(meta2)
                end
                pos.z = pos.z + 1
            end
            pos.y = pos.y + 1
        end
        pos.x = pos.x + 1
    end
    return worldedit.volume(pos1, pos2)
end



--rotates a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise around axis `axis` (90 degree increment), returning the number of nodes rotated
worldedit.rotate = function(pos1, pos2, axis, angle)
    local pos1, pos2 = worldedit.sort_pos(pos1, pos2)

    local axis1, axis2
    if axis == "x" then
        axis1, axis2 = "z", "y"
    elseif axis == "y" then
        axis1, axis2 = "x", "z"
    else --axis == "z"
        axis1, axis2 = "y", "x"
    end
    angle = angle % 360

    if angle == 90 then
        worldedit.flip(pos1, pos2, axis2)                --swapped
        worldedit.transpose(pos1, pos2, axis1, axis2)    --swapped
    elseif angle == 180 then
        worldedit.flip(pos1, pos2, axis1)
        worldedit.flip(pos1, pos2, axis2)
    elseif angle == 270 then
        worldedit.flip(pos1, pos2, axis1)                --swapped
        worldedit.transpose(pos1, pos2, axis1, axis2)    --swapped
    end
    return worldedit.volume(pos1, pos2)
end

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

Hey Smitje, sorry about the delay in replying. my forum notifications apparently haven't been getting through for almost an entire month. And I was wondering why there was so little activity on the forums lately...

Anyways, this is a known issue (see here: https://github.com/Uberi/MineTest-WorldEdit/issues/8), I will try your solution out when I get to a computer. Thanks for testing.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

Update:
  • Rotation and transposition fixed! Thanks Smitje!
  • Markers are now moved to new positions when rotating/transposing.
  • Small bugs fixed.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

Update:
  • //replaceinverse command: replaces all nodes that are NOT a specific type of node. Also has corresponding function in WorldEdit API, worldedit.replaceinverse.
  • //orient command: rotates facedir and wallmounted nodes such as furnaces, stairs, torches, and etc. around the Y-axis. Also has corresponding function in WorldEdit API, worldedit.orient.
  • //lua command: runs arbitrary Lua code on the server, which can do literally anything Lua can. Also has corresponding function in WorldEdit API, worldedit.lua.
  • //luatransform command: runs arbitrary Lua code on the server for each node in the WorldEdit region. Also has corresponding function in WorldEdit API, worldedit.luatransform.
  • All Lua functions are sandboxed and errors will not crash MineTest. However, they do require the "server" privilege, since they can do things like read and modify files on the computer. Only give this privilege to people you trust.
All documentation is included with the download. See "Chat Commands.md" for a list of all commands, and "WorldEdit API.md" if you are developing against it.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

socramazibi
Member
Posts: 81
Joined: Mon Jan 28, 2013 12:29
Location: España

by socramazibi » Post

Hey, so what's not, but I have not seen, in the world of minecraft edit, there is an option to copy cut and paste, could be implemented?

Good Mod

Thanks a Greeting
Forgive my English, but it is the translator of google.My Spanish.
My mod:
Pictures wool 1.0 3x5 , Charcoal+Textures , Map

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

@socramazibi: in MineTest-WorldEdit, you can get the equivalent functionality using //save and //load. If you also need to preserve metadata, use //metasave and //metaload.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

Feature request: when using the //rotate command to rotate around the y axis, any items with facedir within the rotated region should also rotate accordingly.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

VanessaE: that is implemented in the //orient command added recently. A //rotate followed by an //orient should do the trick. It also works for Wallmounted.

Do you think //rotate should do both?
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

sfan5
Moderator
Posts: 4094
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Temperest wrote:Do you think //rotate should do both?
No
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

Heh. Well in that case, I withdraw my suggestion. Now, that said, all these new commands really need to be documented on the first post. It's kinda hard to know what to use if you have to dig through 10 forum pages to find out. :-)
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

VanessaE, all commands are fully documented in Chat Commands.md, as well as being listed when you use the /help command in game. /help /orient, for example, displays the description for the //orient command.

Hey sfan5, would you be willing to link to the README in the first post instead of the commands list? A whole bunch of people are missing the README :)
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

Actually I wasn't aware of the Chat Commands file, and /help is of little use if you can't tell which commands belong to which mod, let alone whether any of them are what you need. :-)

I've added a link to the first post pointing to that file, for future reference.

In my opinion, the whole first post should be rewritten to be better organized, broken into sections (I'm kinda partial to how I format my mod topics :-) ), and most of the commands should be removed from the first post in favor of what is listed in Chat Commands.md.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

I noticed a bug: when you do something like //rotate y 90, the new pos1 and pos2 will be at the same y-level and therefore will not select the initial region.

sfan5
Moderator
Posts: 4094
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Other people would call that a feature ;)
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

Temperest
Member
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Post

Fixed in https://github.com/Uberi/MineTest-World ... 57ef2b0d3.

Please redownload to obtain the fix.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests