From 0769072966289e14c34b69ad622f73c9e51bd70c Mon Sep 17 00:00:00 2001 From: WILLATRONIX Date: Sun, 19 May 2024 17:03:04 +0100 Subject: [PATCH 1/7] Update gizmos and added scriptbrush --- src/SUMMARY.md | 1 + src/editor/gizmos.md | 2 + src/tools/painting/scriptbrush.md | 89 +++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 src/tools/painting/scriptbrush.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 7fd22e3..d900957 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -41,6 +41,7 @@ - [Biome Painter](tools/painting/biomepainter.md) - [Clentaminator](tools/painting/clentaminator.md) - [Gradient Painter](tools/painting/gradientpainter.md) + - [Script Brush](tools/painting/scriptbrush.md) - [Drawing Tools](tools/drawing/intro.md) - [Freehand Draw](tools/drawing/freehanddraw.md) - [Sculpt Draw](tools/drawing/sculptdraw.md) diff --git a/src/editor/gizmos.md b/src/editor/gizmos.md index fe1c6b5..bcde2ac 100644 --- a/src/editor/gizmos.md +++ b/src/editor/gizmos.md @@ -7,3 +7,5 @@ A gizmo can contain the following elements: - **Center Node** The center node can be clicked and dragged to move the gizmo on all 3 axis. While dragging, the gizmo will maintain the same distance to the camera. - **Rotation Rings** Some operations like placement or shape placement will add a rotation ring to the Gizmo, allowing you to perform rotations in addition to translations. The rotation ring can be grabbed and drag to rotate the object around that axis. +- **Global Gizmos** A global gizmo has its rotation and axis arrows locked to the world xyz. +- **Local Gizmos** Unlike global gizmos, local gizmos have their rotation and axis locked to the object itself. Rotating your object 45 degrees will alter your axis arrows by 45 degrees. diff --git a/src/tools/painting/scriptbrush.md b/src/tools/painting/scriptbrush.md new file mode 100644 index 0000000..bb32698 --- /dev/null +++ b/src/tools/painting/scriptbrush.md @@ -0,0 +1,89 @@ +## Script Brush + +The Script Brush is a very unique tool, it allows you to create your own brush. This can be for easing the building process or adding new tools to axiom. + +- The Script Brush is an advanced tool catered towards advanced users. The brush requires some knowledge in programming languages like Python. + +- An IDE[^note4] window is used to input your code. It uses a similar language to Python called Lua[^note1]. + +- Lua doesn't require line indentation like most languages but axiom provides a tabbing feature to indent. There is only one built-in library[^note3] and does not include any others. + +There are many predefined variables and functions, these can be used throughout the script to interact with the world. Listed below, are all variables and functions with descriptions and examples. + +## Custom Variables + +| Variables | Description | Example | +|----------------|----------------------------------------------------------------|--------------| +| x,y,z | These three variables represent the XYZ coordinates. | if y==5 | +| blocks | Can be used to retrieve the blockstate[^note2] ID for a block. | blocks.stone | + +## Custom Functions + +| Functions | Description | Example | +|-------------------------------------------|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------| +| getBlock(x,y,z) | Returns the block ID at the given position (x,y,z). | if getBlock(x,y,z)==blocks.stone | +| getBlockState(x,y,z) | Returns the blockstate[^note2] ID at a given position. | if getBlockstate(x,y,z)==withBlockProperty(blocks.oak_slab,"waterlogged=true") | +| getHighestBlockYAt(x,z) | Returns the Y value of the highest block on the XZ coordinates. | if getHighestBlockYAt(x,z)==20 | +| getSimplexNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Simplex noise for the provided coordinates. | if getSimplexNoise(x,y,z,)=>0.5 | +| getVoroniEdgeNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Voroni Edge noise for the provided coordinates. | if getVoroniEdgeNoise(x,y,z,)=>0.5 | +| isSolid(block) | Returns true if the block is solid, false if not. | if isSolid(getBlock(x,y,z)) | +| isBlockTagged(block,"tag") | Returns true if the block has the provided tag, false if not. | if isBlockTagged(getBlock(x,y,z),"wooden_fences") | +| withBlockProperty(block,"property=value") | Used to return or set a block with a block property. | setBlock(x,y,z,withBlockProperty(blocks.oak_slab,"waterlogged=true")) | +| getBlockProperty(block,"property") | Returns the value of the provided block property. | if getBlockProperty(blocks.oak_slab,"waterlogged")==true | +| setBlock(x,y,z,block) | Set an additional block at a given position. | setBlock(x,y,z,blocks.stone) | + +## Template Variables + +Template Variables are not shown in the help text. Template Variables are used to visually display tool settings, removing the need to edit values within the script itself. Most Template Variables Use a **title**, this is used to display the usage or function of the specific Template Variable. The **default** value is used to set the most appropriate value within the range. The **min** and **max** variables are used to set the ranges on sliders. + +| Template Variable | Description | Example | +|-------------------------------------------|---------------------------------------|------------------------------------| +| $once$ | Runs the script once per click. | $once$ | +| $blockState(title,block)$ | Allows blocks to be input using GUI. | $blockState(Block to Paint,stone)$ | +| $int(title,default,min,max)$ | Creates a slider with whole values. | $int(Randomness Multiplier,1,0,2)$ | +| $float(title,default,min,max)$ | Creates a slider with decimal values. | $float(Noise Threshold,0.5,0,1)$ | +| $boolean(title,default(true/false))$ | Creates a toggle | $boolean(Disable Randomness,true)$ | + +## Code Examples + +The script below places lily pads above water using white noise and simplex noise. + +
+chance=$float(Chance,0.5,0,1)$
+multiplier=$float(Multiplier,1,0,2)$
+
+noise=getSimplexNoise(x/8,y/8,z/8)
+
+if getBlock(x,y-1,z)==blocks.water  and getBlock(x,y,z)==blocks.air and noise<(0.5*multiplier) and math.random()< chance then
+    return blocks.lily_pad
+end
+
+ +This more advanced script generates kelp underwater at a set length. + +
+multiplier=$float(Multiplier,1,0.01,4)$
+heightMax=$int(Maximum Height,25,1,50)$
+
+noise=math.random()
+length=math.floor(math.random(0,heightMax))
+
+if noise<(multiplier*0.1) and isSolid(getBlock(x,y-length,z)) and getBlock(x,y,z)==blocks.water then
+    for block = 0,length do
+        if not isSolid(getBlock(x,y-block,z)) then
+            setBlock(x,y-block,z,blocks.kelp_plant)
+        end
+    end
+    return blocks.kelp
+end
+
+ +## References + +[^note1]: Lua is a lightweight programming language designed for embedded use within applications. + +[^note2]: Blockstate IDs are calculated using [Block IDs](https://minecraftitemids.com/). The formula for blockstate IDs are `-n-x` where n is the Block ID and x is the block state. + +[^note3]: The [Math Library](https://www.lua.org/pil/18.html) is the only built-in library in the Script Brush. + +[^note4]: An integrated development environment (IDE) is a software application that provides comprehensive facilities for software development. \ No newline at end of file From fa5907d761c32fdca0c1e64d5e86a47dbe697774 Mon Sep 17 00:00:00 2001 From: WILLATRONIX Date: Sun, 19 May 2024 20:37:57 +0100 Subject: [PATCH 2/7] Fix shape and scriptbrush errors --- src/tools/drawing/shape.md | 8 ++++++++ src/tools/painting/scriptbrush.md | 16 +++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/tools/drawing/shape.md b/src/tools/drawing/shape.md index 9f006b8..a9618cc 100644 --- a/src/tools/drawing/shape.md +++ b/src/tools/drawing/shape.md @@ -4,6 +4,8 @@ The Shape Tool lets you make geometric shapes with your active block. Since thes Each shape lets you tweak its XZ or XYZ dimensions. In addition to controlling rotation using the gizmo, you can also alter the angle sliders for yaw, pitch, and roll in the 'advanced options' dropdown. Plus, there are options for making the shapes hollow, placing only the outer layer. +## List of Shapes + | Shapes      | |-------------| | Sphere      | @@ -17,17 +19,23 @@ Each shape lets you tweak its XZ or XYZ dimensions. In addition to controlling r | Dodecahedron| | Icosahedron | +## Options + | Option       | Description                                                       | |--------------|-------------------------------------------------------------------| | Separate XYZ | When enabled, all three scale axes can be modified separately.    | | Diameter     | This slider controls the size or scale of the selected shape.     | | Advanced     | Allows you to directly alter the yaw, pitch and roll via sliders. | +## Modifiers + | Modifier | Description                           | |----------|---------------------------------------| | Hollow   | Generates the shape filled with air   | | Metaball | Applies a melting effect to the shape | +## Placement + | Placement           | Description                                                 | |---------------------|-------------------------------------------------------------| | Gizmo               | Switch between a global or local [gizmo](/editor/gizmos.md) | diff --git a/src/tools/painting/scriptbrush.md b/src/tools/painting/scriptbrush.md index bb32698..da97466 100644 --- a/src/tools/painting/scriptbrush.md +++ b/src/tools/painting/scriptbrush.md @@ -8,6 +8,8 @@ The Script Brush is a very unique tool, it allows you to create your own brush. - Lua doesn't require line indentation like most languages but axiom provides a tabbing feature to indent. There is only one built-in library[^note3] and does not include any others. +# The Script must return a block or use setBlock() to modify blocks in the world. + There are many predefined variables and functions, these can be used throughout the script to interact with the world. Listed below, are all variables and functions with descriptions and examples. ## Custom Variables @@ -36,13 +38,13 @@ There are many predefined variables and functions, these can be used throughout Template Variables are not shown in the help text. Template Variables are used to visually display tool settings, removing the need to edit values within the script itself. Most Template Variables Use a **title**, this is used to display the usage or function of the specific Template Variable. The **default** value is used to set the most appropriate value within the range. The **min** and **max** variables are used to set the ranges on sliders. -| Template Variable | Description | Example | -|-------------------------------------------|---------------------------------------|------------------------------------| -| $once$ | Runs the script once per click. | $once$ | -| $blockState(title,block)$ | Allows blocks to be input using GUI. | $blockState(Block to Paint,stone)$ | -| $int(title,default,min,max)$ | Creates a slider with whole values. | $int(Randomness Multiplier,1,0,2)$ | -| $float(title,default,min,max)$ | Creates a slider with decimal values. | $float(Noise Threshold,0.5,0,1)$ | -| $boolean(title,default(true/false))$ | Creates a toggle | $boolean(Disable Randomness,true)$ | +| Template Variable | Description | Example | +|---------------------------------------|---------------------------------------|------------------------------------| +| `$once$` | Runs the script once per click. | $once$ | +| `$blockState(title,block)$` | Allows blocks to be input using GUI. | $blockState(Block to Paint,stone)$ | +| `$int(title,default,min,max)$` | Creates a slider with whole values. | $int(Randomness Multiplier,1,0,2)$ | +| `$float(title,default,min,max)$` | Creates a slider with decimal values. | $float(Noise Threshold,0.5,0,1)$ | +| `$boolean(title,default(true/false))$`| Creates a toggle | $boolean(Disable Randomness,true)$ | ## Code Examples From de18c1774d17d67e740784aa278003e974e4ce20 Mon Sep 17 00:00:00 2001 From: WILLATRONIX Date: Sun, 19 May 2024 20:41:42 +0100 Subject: [PATCH 3/7] Another minor fix to scriptbrush --- src/tools/painting/scriptbrush.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tools/painting/scriptbrush.md b/src/tools/painting/scriptbrush.md index da97466..10107fb 100644 --- a/src/tools/painting/scriptbrush.md +++ b/src/tools/painting/scriptbrush.md @@ -14,10 +14,10 @@ There are many predefined variables and functions, these can be used throughout ## Custom Variables -| Variables | Description | Example | -|----------------|----------------------------------------------------------------|--------------| -| x,y,z | These three variables represent the XYZ coordinates. | if y==5 | -| blocks | Can be used to retrieve the blockstate[^note2] ID for a block. | blocks.stone | +| Variables | Description | Example | +|-----------|----------------------------------------------------------------|--------------| +| x,y,z | These three variables represent the XYZ coordinates. | if y==5 | +| blocks | Can be used to retrieve the blockstate[^note2] ID for a block. | blocks.stone | ## Custom Functions @@ -38,13 +38,13 @@ There are many predefined variables and functions, these can be used throughout Template Variables are not shown in the help text. Template Variables are used to visually display tool settings, removing the need to edit values within the script itself. Most Template Variables Use a **title**, this is used to display the usage or function of the specific Template Variable. The **default** value is used to set the most appropriate value within the range. The **min** and **max** variables are used to set the ranges on sliders. -| Template Variable | Description | Example | -|---------------------------------------|---------------------------------------|------------------------------------| -| `$once$` | Runs the script once per click. | $once$ | -| `$blockState(title,block)$` | Allows blocks to be input using GUI. | $blockState(Block to Paint,stone)$ | -| `$int(title,default,min,max)$` | Creates a slider with whole values. | $int(Randomness Multiplier,1,0,2)$ | -| `$float(title,default,min,max)$` | Creates a slider with decimal values. | $float(Noise Threshold,0.5,0,1)$ | -| `$boolean(title,default(true/false))$`| Creates a toggle | $boolean(Disable Randomness,true)$ | +| Template Variable | Description | Example | +|---------------------------------------|---------------------------------------|--------------------------------------| +| `$once$` | Runs the script once per click. | `$once$` | +| `$blockState(title,block)$` | Allows blocks to be input using GUI. | `$blockState(Block to Paint,stone)$` | +| `$int(title,default,min,max)$` | Creates a slider with whole values. | `$int(Randomness Multiplier,1,0,2)$` | +| `$float(title,default,min,max)$` | Creates a slider with decimal values. | `$float(Noise Threshold,0.5,0,1)$` | +| `$boolean(title,default(true/false))$`| Creates a toggle | `$boolean(Disable Randomness,true)$` | ## Code Examples From 1291c8e2de3b09647fcddec9812bda2d03225cd8 Mon Sep 17 00:00:00 2001 From: WILLATRONIX <111201886+WILLATRONIX@users.noreply.github.com> Date: Sun, 19 May 2024 21:42:58 +0100 Subject: [PATCH 4/7] Update scriptbrush.md fixed incorrect header size --- src/tools/painting/scriptbrush.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/painting/scriptbrush.md b/src/tools/painting/scriptbrush.md index 10107fb..7b39fb4 100644 --- a/src/tools/painting/scriptbrush.md +++ b/src/tools/painting/scriptbrush.md @@ -8,7 +8,7 @@ The Script Brush is a very unique tool, it allows you to create your own brush. - Lua doesn't require line indentation like most languages but axiom provides a tabbing feature to indent. There is only one built-in library[^note3] and does not include any others. -# The Script must return a block or use setBlock() to modify blocks in the world. +### The Script must return a block or use setBlock() to modify blocks in the world. There are many predefined variables and functions, these can be used throughout the script to interact with the world. Listed below, are all variables and functions with descriptions and examples. @@ -88,4 +88,4 @@ end [^note3]: The [Math Library](https://www.lua.org/pil/18.html) is the only built-in library in the Script Brush. -[^note4]: An integrated development environment (IDE) is a software application that provides comprehensive facilities for software development. \ No newline at end of file +[^note4]: An integrated development environment (IDE) is a software application that provides comprehensive facilities for software development. From e976512e3d7746feea6caddfb1c1927d1694617a Mon Sep 17 00:00:00 2001 From: WILLATRONIX <111201886+WILLATRONIX@users.noreply.github.com> Date: Sun, 19 May 2024 21:48:48 +0100 Subject: [PATCH 5/7] Update scriptbrush.md fixed awkward table sizing --- src/tools/painting/scriptbrush.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/painting/scriptbrush.md b/src/tools/painting/scriptbrush.md index 7b39fb4..245a87f 100644 --- a/src/tools/painting/scriptbrush.md +++ b/src/tools/painting/scriptbrush.md @@ -24,13 +24,13 @@ There are many predefined variables and functions, these can be used throughout | Functions | Description | Example | |-------------------------------------------|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------| | getBlock(x,y,z) | Returns the block ID at the given position (x,y,z). | if getBlock(x,y,z)==blocks.stone | -| getBlockState(x,y,z) | Returns the blockstate[^note2] ID at a given position. | if getBlockstate(x,y,z)==withBlockProperty(blocks.oak_slab,"waterlogged=true") | +| getBlockState(x,y,z) | Returns the blockstate[^note2] ID at a given position. | if getBlockstate(x,y,z)==withBlockProperty(blocks.chain,"axis=x") | | getHighestBlockYAt(x,z) | Returns the Y value of the highest block on the XZ coordinates. | if getHighestBlockYAt(x,z)==20 | | getSimplexNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Simplex noise for the provided coordinates. | if getSimplexNoise(x,y,z,)=>0.5 | | getVoroniEdgeNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Voroni Edge noise for the provided coordinates. | if getVoroniEdgeNoise(x,y,z,)=>0.5 | | isSolid(block) | Returns true if the block is solid, false if not. | if isSolid(getBlock(x,y,z)) | | isBlockTagged(block,"tag") | Returns true if the block has the provided tag, false if not. | if isBlockTagged(getBlock(x,y,z),"wooden_fences") | -| withBlockProperty(block,"property=value") | Used to return or set a block with a block property. | setBlock(x,y,z,withBlockProperty(blocks.oak_slab,"waterlogged=true")) | +| withBlockProperty(block,"property=value") | Used to return or set a block with a block property. | withBlockProperty(blocks.oak_slab,"waterlogged=true") | | getBlockProperty(block,"property") | Returns the value of the provided block property. | if getBlockProperty(blocks.oak_slab,"waterlogged")==true | | setBlock(x,y,z,block) | Set an additional block at a given position. | setBlock(x,y,z,blocks.stone) | From 6bf23fb42cda09effbddb7cfcae00f4b5860229a Mon Sep 17 00:00:00 2001 From: WILLATRONIX <111201886+WILLATRONIX@users.noreply.github.com> Date: Sun, 19 May 2024 23:22:04 +0100 Subject: [PATCH 6/7] Update scriptbrush.md fixed incorrect examples --- src/tools/painting/scriptbrush.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/painting/scriptbrush.md b/src/tools/painting/scriptbrush.md index 245a87f..1cc58c2 100644 --- a/src/tools/painting/scriptbrush.md +++ b/src/tools/painting/scriptbrush.md @@ -26,8 +26,8 @@ There are many predefined variables and functions, these can be used throughout | getBlock(x,y,z) | Returns the block ID at the given position (x,y,z). | if getBlock(x,y,z)==blocks.stone | | getBlockState(x,y,z) | Returns the blockstate[^note2] ID at a given position. | if getBlockstate(x,y,z)==withBlockProperty(blocks.chain,"axis=x") | | getHighestBlockYAt(x,z) | Returns the Y value of the highest block on the XZ coordinates. | if getHighestBlockYAt(x,z)==20 | -| getSimplexNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Simplex noise for the provided coordinates. | if getSimplexNoise(x,y,z,)=>0.5 | -| getVoroniEdgeNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Voroni Edge noise for the provided coordinates. | if getVoroniEdgeNoise(x,y,z,)=>0.5 | +| getSimplexNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Simplex noise for the provided coordinates. | if getSimplexNoise(x,y,z,"WILLATRONIXisCOOL")=>0.5 | +| getVoroniEdgeNoise(x,y,z,"seed") | Returns a value between 0 and 1, representing the Voroni Edge noise for the provided coordinates. | if getVoroniEdgeNoise(x,y,z,"coolseed")=>0.5 | | isSolid(block) | Returns true if the block is solid, false if not. | if isSolid(getBlock(x,y,z)) | | isBlockTagged(block,"tag") | Returns true if the block has the provided tag, false if not. | if isBlockTagged(getBlock(x,y,z),"wooden_fences") | | withBlockProperty(block,"property=value") | Used to return or set a block with a block property. | withBlockProperty(blocks.oak_slab,"waterlogged=true") | From 20c7e5256a12b74d450f2f2118ce3d247491f8c5 Mon Sep 17 00:00:00 2001 From: WILLATRONIX <111201886+WILLATRONIX@users.noreply.github.com> Date: Sun, 19 May 2024 23:43:38 +0100 Subject: [PATCH 7/7] Update scriptbrush.md grammar/spelling errors --- src/tools/painting/scriptbrush.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/painting/scriptbrush.md b/src/tools/painting/scriptbrush.md index 1cc58c2..8c36376 100644 --- a/src/tools/painting/scriptbrush.md +++ b/src/tools/painting/scriptbrush.md @@ -2,15 +2,15 @@ The Script Brush is a very unique tool, it allows you to create your own brush. This can be for easing the building process or adding new tools to axiom. -- The Script Brush is an advanced tool catered towards advanced users. The brush requires some knowledge in programming languages like Python. +- The Script Brush is an advanced tool catered towards advanced users. The brush requires some knowledge of programming languages like Python. - An IDE[^note4] window is used to input your code. It uses a similar language to Python called Lua[^note1]. -- Lua doesn't require line indentation like most languages but axiom provides a tabbing feature to indent. There is only one built-in library[^note3] and does not include any others. +- Lua doesn't require line indentation like most languages but axiom provides a tabbing feature to indent. There is only one built-in library[^note3] and there are currently no others. ### The Script must return a block or use setBlock() to modify blocks in the world. -There are many predefined variables and functions, these can be used throughout the script to interact with the world. Listed below, are all variables and functions with descriptions and examples. +There are many predefined variables and functions that can be used throughout the script to interact with the world. Listed below, are all variables and functions with descriptions and examples. ## Custom Variables @@ -84,7 +84,7 @@ end [^note1]: Lua is a lightweight programming language designed for embedded use within applications. -[^note2]: Blockstate IDs are calculated using [Block IDs](https://minecraftitemids.com/). The formula for blockstate IDs are `-n-x` where n is the Block ID and x is the block state. +[^note2]: Blockstate IDs are calculated using [Block IDs](https://minecraftitemids.com/). The formula for blockstate IDs is `-n-x` where n is the Block ID and x is the block state. [^note3]: The [Math Library](https://www.lua.org/pil/18.html) is the only built-in library in the Script Brush.