From 3f51534749b779d3b9c3bef0b6f12dc02a55e7f7 Mon Sep 17 00:00:00 2001 From: Eldarduil Date: Sun, 8 Nov 2026 20:24:52 +0300 Subject: [PATCH 1/8] Terrain 3D Scattered Models update Property change: Height to Scale Factor Added two expression functions for gettin copy angle and scale Added one extension action for automating the object replacement with the copy --- extensions/reviewed/Terrain3D.json | 1486 ++++++++++++++++++++++------ 1 file changed, 1184 insertions(+), 302 deletions(-) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index a6b15bef5..946b7e51b 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -9,8 +9,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXRlcnJhaW4iIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQsNkwxMC4yNSwxMUwxMy4xLDE0LjhMMTEuNSwxNkM5LjgxLDEzLjc1IDcsMTAgNywxMEwxLDE4SDIzTDE0LDZaIiAvPjwvc3ZnPg==", "name": "Terrain3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/10e0a26c0d500830dfe23b94138beb0ef61607ba62bca05a5aa5c849777f1b06_terrain.svg", - "shortDescription": "A ground with hills and valleys that can be sculpted and painted in the editor, with collisions.", - "version": "0.2.0", + "shortDescription": "Editable copy of Terrain3D with the ModelUpAxis/ModelAnchor fix and new copy expressions.", + "version": "0.3.1", "description": [ "A 3D terrain object for open worlds, adventure or racing games: hills, mountains, islands or valleys, with painted layers of grass, dirt, rock or sand.", "", @@ -27,10 +27,6 @@ "- **Tunnels and caves**: make holes in the ground (and fill them again) with the brushes, the Edits property or actions, and put a 3D model of the tunnel or the cave (with a mesh collision shape) under the ground. Nothing is drawn in holes, and characters, cars and rays go through them.", "- **Made for large worlds**: the terrain is split in chunks that are hidden when off-screen and simplified when far away, and collisions are updated only where the ground changes." ], - "origin": { - "identifier": "Terrain3D", - "name": "gdevelop-extension-store" - }, "tags": [ "3d", "terrain", @@ -51,9 +47,11 @@ "sceneVariables": [], "eventsFunctions": [ { + "description": "Define helper classes JavaScript code.", "fullName": "Define helper classes", "functionType": "Action", "name": "DefineHelperClasses", + "private": true, "sentence": "Define helper classes JavaScript code", "events": [ { @@ -3103,14 +3101,14 @@ } ], "parameters": [], - "objectGroups": [], - "description": "Define helper classes JavaScript code.", - "private": true + "objectGroups": [] }, { + "description": "Define grass helper classes JavaScript code.", "fullName": "Define grass helper classes", "functionType": "Action", "name": "DefineGrassHelperClasses", + "private": true, "sentence": "Define grass helper classes JavaScript code", "events": [ { @@ -3448,18 +3446,18 @@ ], "parameterObjects": "", "useStrict": true, - "eventsSheetExpanded": false + "eventsSheetExpanded": true } ], "parameters": [], - "objectGroups": [], - "description": "Define grass helper classes JavaScript code.", - "private": true + "objectGroups": [] }, { + "description": "Define scattered models helper classes JavaScript code.", "fullName": "Define scattered models helper classes", "functionType": "Action", "name": "DefineScatterHelperClasses", + "private": true, "sentence": "Define scattered models helper classes JavaScript code", "events": [ { @@ -3691,18 +3689,39 @@ "};", "", "/**", + " * The parts of a model and its size, per unit of height, around the point", + " * of the model put on the ground (its anchor).", + " * @typedef {{", + " * parts: Array<{geometry: THREE.BufferGeometry, material: THREE.Material | THREE.Material[]}>,", + " * width: number,", + " * depth: number,", + " * bottom: number,", + " * top: number,", + " * reach: number,", + " * }} ModelParts", + " * `bottom` and `top` are the Z of the model base and top from the anchor.", + " * `reach` is the farthest distance of the model from the anchor on X and Y,", + " * whatever the rotation of the copy.", + " */", + "", + "/** @type {ModelParts} */", + "const emptyModelParts = { parts: [], width: 0, depth: 0, bottom: 0, top: 1, reach: 0, naturalHeight: 1 };", + "", + "/**", " * The parts of a model, ready to be drawn with instancing: each glTF", - " * primitive with its material. Geometries are moved so that the model base", - " * is at the origin, its height is 1 and it stands along Z (like 3D model", - " * objects with a 90° rotation around X).", + " * primitive with its material. Geometries are moved so that the anchor is at", + " * the origin, the model height is 1 and it stands along Z (like 3D model", + " * objects with a 90° rotation around X, for models standing on Y).", " * @param {THREE.Object3D} modelScene", " * @param {object} uniforms Uniforms added to the materials.", - " * @returns {{parts: Array<{geometry: THREE.BufferGeometry, material: THREE.Material | THREE.Material[]}>, width: number, depth: number}}", + " * @param {{isStandingOnZ: boolean, isAnchoredAtOrigin: boolean}} options", + " * The anchor is the origin of the model, or else the center of its base.", + " * @returns {ModelParts}", " */", - "const createModelParts = (modelScene, uniforms) => {", + "const createModelParts = (modelScene, uniforms, { isStandingOnZ, isAnchoredAtOrigin }) => {", " modelScene.updateMatrixWorld(true);", " const rootInverse = modelScene.matrixWorld.clone().invert();", - " const standUp = new THREE.Matrix4().makeRotationX(Math.PI / 2);", + " const standUp = isStandingOnZ ? new THREE.Matrix4() : new THREE.Matrix4().makeRotationX(Math.PI / 2);", " /** @type {Array<{mesh: THREE.Mesh, matrix: THREE.Matrix4}>} */", " const meshes = [];", " const box = new THREE.Box3();", @@ -3713,19 +3732,22 @@ " box.union(node.geometry.boundingBox.clone().applyMatrix4(matrix));", " meshes.push({ mesh: node, matrix });", " });", - " if (box.isEmpty()) return { parts: [], width: 0, depth: 0 };", + " if (box.isEmpty()) return emptyModelParts;", "", " const height = Math.max(box.max.z - box.min.z, 0.000001);", " // The Y axis of the scene goes down: the model is flipped, like 3D model objects.", " const normalization = new THREE.Matrix4()", " .makeScale(1 / height, -1 / height, 1 / height)", " .multiply(", - " new THREE.Matrix4().makeTranslation(", - " -(box.min.x + box.max.x) / 2,", - " -(box.min.y + box.max.y) / 2,", - " -box.min.z", - " )", + " isAnchoredAtOrigin", + " ? new THREE.Matrix4()", + " : new THREE.Matrix4().makeTranslation(", + " -(box.min.x + box.max.x) / 2,", + " -(box.min.y + box.max.y) / 2,", + " -box.min.z", + " )", " );", + " const normalizedBox = box.clone().applyMatrix4(normalization);", " const parts = meshes.map(({ mesh, matrix }) => {", " let geometry = mesh.geometry.clone();", " if (!geometry.index) {", @@ -3756,15 +3778,23 @@ " });", " return {", " parts,", + " naturalHeight: height,", " width: (box.max.x - box.min.x) / height,", " depth: (box.max.y - box.min.y) / height,", + " bottom: normalizedBox.min.z,", + " top: normalizedBox.max.z,", + " reach: Math.hypot(", + " Math.max(-normalizedBox.min.x, normalizedBox.max.x),", + " Math.max(-normalizedBox.min.y, normalizedBox.max.y)", + " ),", " };", "};", "", "/**", - " * A copy of the model: its base position in the scene, its scale (the", - " * height of the copy) and the key of its cell in the grid of copies.", - " * @typedef {{x: number, y: number, z: number, angle: number, height: number, key: number}} Copy", + " * A copy of the model: the position of its anchor in the scene (on the ground), its scale", + " * factor (1 = the model at its original size) and rendered height in pixels, and the key", + " * of its cell in the grid of copies.", + " * @typedef {{x: number, y: number, z: number, angle: number, height: number, scale: number, key: number}} Copy", " */", "", "/**", @@ -3791,8 +3821,11 @@ " scatterDrawDistance: { value: 1 },", " };", " /** @type {{parts: Array<{geometry: THREE.BufferGeometry, material: THREE.Material | THREE.Material[]}>, width: number, depth: number}} */", - " this.model = { parts: [], width: 0, depth: 0 };", + " /** @type {ModelParts} */", + " this.model = emptyModelParts;", " this.modelResourceName = '';", + " /** The properties the model was loaded from (see `_getModelKey`). */", + " this.modelKey = '';", " this.loadingModelResourceName = '';", " /**", " * Copies removed by events (for example, cut trees), by key.", @@ -3886,11 +3919,16 @@ " return this.paintData;", " }", "", - " updateFromProperties() {", + " _getModelKey() {", " const { object } = this;", - " const modelResourceName = object._getModel();", - " if (modelResourceName !== this.modelResourceName) {", - " this.modelResourceName = modelResourceName;", + " return object._getModel() + '|' + object._getModelUpAxis() + '|' + object._getModelAnchor();", + " }", + "", + " updateFromProperties() {", + " const modelKey = this._getModelKey();", + " if (modelKey !== this.modelKey) {", + " this.modelKey = modelKey;", + " this.modelResourceName = this.object._getModel();", " this._loadModel();", " }", " this.placement.placeAgain();", @@ -3903,7 +3941,8 @@ " material.dispose();", " }", " }", - " this.model = { parts: [], width: 0, depth: 0 };", + " /** @type {ModelParts} */", + " this.model = emptyModelParts;", " }", "", " _loadModel() {", @@ -3931,14 +3970,17 @@ " .catch(() => {});", " return;", " }", - " this.model = createModelParts(gltf.scene, this.uniforms);", + " this.model = createModelParts(gltf.scene, this.uniforms, {", + " isStandingOnZ: this.object._getModelUpAxis() === 'Z',", + " isAnchoredAtOrigin: this.object._getModelAnchor() === 'ModelOrigin',", + " });", " }", "", " _getPlacementKey() {", " const { object } = this;", " return [", " object.getX(), object.getY(), object.getZ(), object.getWidth(), object.getHeight(), object.getDepth(),", - " object._getDensity(), object._getSize(), object._getMinScale(), object._getMaxScale(),", + " object._getDensity(), object._getScaleFactor(), object._getMinScale(), object._getMaxScale(),", " object._getRandomRotation(), object._getRandomTint(), object._getGroundLayer(), object._getMaxSlope(),", " object._getMinGroundZ(), object._getMaxGroundZ(), object._getSeed(), object._getDrawDistance(),", " object._getCastShadow(), object._getReceiveShadow(), this.model.parts.length,", @@ -3986,9 +4028,10 @@ " const { ground, z } = findHighestGround(grounds, sceneX, sceneY, this._groundAtCopy);", " const groundZ = ground ? z : object.getZ();", " if (groundZ < object._getMinGroundZ() || groundZ > object._getMaxGroundZ()) return null;", - " const copyHeight =", - " Math.max(object._getSize(), 0) *", + " const copyScale =", + " (Math.max(object._getScaleFactor(), 0) / 100) *", " (object._getMinScale() + (object._getMaxScale() - object._getMinScale()) * scaleFactor);", + " const copyHeight = copyScale * this.model.naturalHeight * 100;", " if (ground) {", " if (ground.getSlopeAt(sceneX, sceneY) > object._getMaxSlope()) return null;", " const groundLayer = parseInt(object._getGroundLayer(), 10) || 0;", @@ -4007,6 +4050,7 @@ " z: groundZ,", " angle: object._getRandomRotation() ? angle : 0,", " height: copyHeight,", + " scale: copyScale,", " key,", " };", " }", @@ -4119,9 +4163,9 @@ " this._color.setRGB(1, 1, 1).lerp(this._tint, createRandom(copy.key + 1)());", " this._color.toArray(colors, index * 3);", " }", - " const reach = (copy.height * Math.max(this.model.width, this.model.depth)) / 2;", - " min.min(this._chunkPosition.set(copy.x - reach, copy.y - reach, copy.z));", - " max.max(this._chunkPosition.set(copy.x + reach, copy.y + reach, copy.z + copy.height));", + " const reach = copy.height * this.model.reach;", + " min.min(this._chunkPosition.set(copy.x - reach, copy.y - reach, copy.z + copy.height * this.model.bottom));", + " max.max(this._chunkPosition.set(copy.x + reach, copy.y + reach, copy.z + copy.height * this.model.top));", " });", " const instanceMatrix = new THREE.InstancedBufferAttribute(matrices, 16);", " const instanceColor = colors ? new THREE.InstancedBufferAttribute(colors, 3) : null;", @@ -4176,12 +4220,12 @@ " ray.origin.multiply(scale).add(this._chunkPosition.set(object.getX(), object.getY(), object.getZ()));", " ray.direction.multiply(scale);", "", - " const reachPerHeight = Math.max(this.model.width, this.model.depth) / 2;", + " const { reach: reachPerHeight, bottom, top } = this.model;", " const instanceMatrices = chunk.meshes[0].instanceMatrix.array;", " chunk.copies.forEach((copy, index) => {", " const reach = copy.height * reachPerHeight;", - " this._raycastBox.min.set(copy.x - reach, copy.y - reach, copy.z);", - " this._raycastBox.max.set(copy.x + reach, copy.y + reach, copy.z + copy.height);", + " this._raycastBox.min.set(copy.x - reach, copy.y - reach, copy.z + copy.height * bottom);", + " this._raycastBox.max.set(copy.x + reach, copy.y + reach, copy.z + copy.height * top);", " if (!ray.intersectsBox(this._raycastBox)) return;", " this._raycastMesh.matrixWorld.fromArray(instanceMatrices, index * 16).premultiply(group.matrixWorld);", " for (const mesh of chunk.meshes) {", @@ -4355,8 +4399,9 @@ " const depth = object.getDepth() || 1;", " let indexOffset = 0;", " copies.forEach((copy, copyIndex) => {", - " const radius = (Math.max(object._getTrunkDiameter(), 0) / 2) * (copy.height / Math.max(object._getSize(), 1));", - " const top = copy.z + copy.height * 0.8;", + " const radius = (Math.max(object._getTrunkDiameter(), 0) / 2) * copy.scale;", + " // Up to 80% of the model height, at least a bit above the ground.", + " const top = copy.z + copy.height * Math.max(this.model.bottom + 0.8, 0.1);", " const firstVertex = copyIndex * verticesPerCopy;", " const setVertex = (vertex, x, y, z) => {", " positions[vertex * 3] = (x - object.getX()) / width;", @@ -4653,15 +4698,247 @@ ], "parameterObjects": "", "useStrict": true, - "eventsSheetExpanded": false + "eventsSheetExpanded": true } ], "parameters": [], - "objectGroups": [], - "description": "Define scattered models helper classes JavaScript code.", - "private": true + "objectGroups": [] + }, + { + "description": "Create an object at the position, angle and scale of the copy of scattered models nearest to a position, and optionally erase that copy. The created object stays picked, so you apply actions to it right after.", + "fullName": "Replace the nearest copy with an object", + "functionType": "Action", + "name": "ReplaceNearestCopyWithObject", + "sentence": "Replace the copy of _PARAM1_ nearest to _PARAM5_; _PARAM6_ with _PARAM2_ (erase the copy: _PARAM7_)", + "events": [ + { + "aiGeneratedEventId": "01M6WAPE2W8KS8P2871Y641HST", + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CopyX", + "=", + "ScatterObject.NearestCopyX(X, Y)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CopyY", + "=", + "ScatterObject.NearestCopyY(X, Y)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CopyZ", + "=", + "ScatterObject.NearestCopyZ(CopyX, CopyY)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CopyAngle", + "=", + "ScatterObject.NearestCopyAngle(CopyX, CopyY)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CopyScale", + "=", + "ScatterObject.NearestCopyScale(CopyX, CopyY)" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "EraseTheCopy", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Terrain3D::ScatteredModels::EraseCopies" + }, + "parameters": [ + "ScatterObject", + "CopyX", + "CopyY", + "1", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "ObjectToCreate", + "CopyX", + "CopyY", + "\"\"" + ] + }, + { + "type": { + "value": "Scene3D::Base3DBehavior::SetZ" + }, + "parameters": [ + "ObjectToCreate", + "Object3DBehavior", + "=", + "CopyZ" + ] + }, + { + "type": { + "value": "SetAngle" + }, + "parameters": [ + "ObjectToCreate", + "=", + "CopyAngle" + ] + }, + { + "type": { + "value": "ScalableCapability::ScalableBehavior::SetValue" + }, + "parameters": [ + "ObjectToCreate", + "ScaleBehavior", + "=", + "CopyScale" + ] + } + ] + } + ], + "variables": [ + { + "name": "CopyX", + "type": "number", + "value": 0 + }, + { + "name": "CopyY", + "type": "number", + "value": 0 + }, + { + "name": "CopyZ", + "type": "number", + "value": 0 + }, + { + "name": "CopyAngle", + "type": "number", + "value": 0 + }, + { + "name": "CopyScale", + "type": "number", + "value": 0 + } + ] + } + ], + "parameters": [ + { + "description": "Scattered models", + "name": "ScatterObject", + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "objectList" + }, + { + "description": "Object to create", + "name": "ObjectToCreate", + "type": "objectListOrEmptyIfJustDeclared" + }, + { + "description": "3D behavior", + "name": "Object3DBehavior", + "supplementaryInformation": "Scene3D::Base3DBehavior", + "type": "behavior" + }, + { + "description": "Scale behavior", + "name": "ScaleBehavior", + "supplementaryInformation": "ScalableCapability::ScalableBehavior", + "type": "behavior" + }, + { + "description": "X position", + "name": "X", + "type": "expression" + }, + { + "description": "Y position", + "name": "Y", + "type": "expression" + }, + { + "defaultValue": "yes", + "description": "Erase the copy", + "name": "EraseTheCopy", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] } ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "DefineHelperClasses" + }, + { + "functionName": "DefineGrassHelperClasses" + }, + { + "functionName": "DefineScatterHelperClasses" + }, + { + "functionName": "ReplaceNearestCopyWithObject" + } + ] + }, "eventsBasedBehaviors": [], "eventsBasedObjects": [ { @@ -4671,10 +4948,11 @@ "areaMinX": 0, "areaMinY": 0, "areaMinZ": 0, - "defaultName": "Terrain", "assetStoreTag": "3d terrains", + "defaultName": "Terrain", "description": "A ground with hills, mountains or valleys that can be sculpted and painted in the scene editor, or changed with events. Add the 3D physics behavior to it to make objects walk or roll on it.", "fullName": "3D terrain", + "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXRlcnJhaW4iIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQsNkwxMC4yNSwxMUwxMy4xLDE0LjhMMTEuNSwxNkM5LjgxLDEzLjc1IDcsMTAgNywxMEwxLDE4SDIzTDE0LDZaIiAvPjwvc3ZnPg==", "is3D": true, "isUsingLegacyInstancesRenderer": true, @@ -4762,16 +5040,15 @@ { "angle": 0, "customSize": true, - "width": 4096, - "height": 4096, "depth": 600, + "height": 4096, "keepRatio": true, "layer": "", "name": "AreaPlaceholder", "persistentUuid": "5d7a8b1e-3c2f-4e6a-9b1d-004096004096", + "width": 4096, "x": 0, "y": 0, - "z": 0, "zOrder": 1, "numberProperties": [], "stringProperties": [], @@ -4821,8 +5098,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" } ], "objectGroups": [] @@ -4849,8 +5126,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" } ], "objectGroups": [] @@ -4877,8 +5154,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" } ], "objectGroups": [] @@ -4905,15 +5182,17 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" } ], "objectGroups": [] }, { + "description": "Raise the ground around a position (or lower it with a negative height). It's raised the most at the center and less and less up to the radius.", "fullName": "Raise or lower the ground", "functionType": "Action", + "group": "Sculpt", "name": "RaiseGround", "sentence": "Raise the ground of _PARAM0_ by _PARAM4_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -4937,8 +5216,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -4952,9 +5231,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance." + "type": "expression" }, { "description": "Height to add (negative to lower the ground)", @@ -4962,13 +5241,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Raise the ground around a position (or lower it with a negative height). It's raised the most at the center and less and less up to the radius.", - "group": "Sculpt" + "objectGroups": [] }, { + "description": "Raise the ground along a line, for example for a ridge, or lower it with a negative height to dig a river bed or a valley.", "fullName": "Raise or lower the ground along a line", "functionType": "Action", + "group": "Sculpt", "name": "RaiseGroundAlongLine", "sentence": "Raise the ground of _PARAM0_ by _PARAM6_ from _PARAM1_; _PARAM2_ to _PARAM3_; _PARAM4_ with a radius of _PARAM5_", "events": [ @@ -4994,8 +5273,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the start", @@ -5019,9 +5298,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance from the line.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance from the line." + "type": "expression" }, { "description": "Height to add (negative to lower the ground)", @@ -5029,13 +5308,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Raise the ground along a line, for example for a ridge, or lower it with a negative height to dig a river bed or a valley.", - "group": "Sculpt" + "objectGroups": [] }, { + "description": "Flatten the ground around a position to a given height, for example to place a building.", "fullName": "Flatten the ground", "functionType": "Action", + "group": "Sculpt", "name": "FlattenGround", "sentence": "Flatten the ground of _PARAM0_ to a Z of _PARAM4_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -5059,8 +5338,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5074,9 +5353,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance." + "type": "expression" }, { "description": "Z position of the flat ground", @@ -5084,13 +5363,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Flatten the ground around a position to a given height, for example to place a building.", - "group": "Sculpt" + "objectGroups": [] }, { + "description": "Smooth the ground around a position, softening bumps and cliffs.", "fullName": "Smooth the ground", "functionType": "Action", + "group": "Sculpt", "name": "SmoothGround", "sentence": "Smooth the ground of _PARAM0_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_ (strength: _PARAM4_)", "events": [ @@ -5114,8 +5393,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5129,9 +5408,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance." + "type": "expression" }, { "description": "Strength (between 0 and 1)", @@ -5139,13 +5418,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Smooth the ground around a position, softening bumps and cliffs.", - "group": "Sculpt" + "objectGroups": [] }, { + "description": "Paint a layer (like grass, dirt, rock or sand) on the ground around a position.", "fullName": "Paint a layer", "functionType": "Action", + "group": "Paint", "name": "PaintLayer", "sentence": "Paint layer _PARAM4_ on _PARAM0_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -5169,8 +5448,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5184,9 +5463,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance." + "type": "expression" }, { "description": "Layer (1 to 4)", @@ -5194,13 +5473,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Paint a layer (like grass, dirt, rock or sand) on the ground around a position.", - "group": "Paint" + "objectGroups": [] }, { + "description": "Paint a layer on the ground along a line, for example for a path or a road.", "fullName": "Paint a layer along a line", "functionType": "Action", + "group": "Paint", "name": "PaintLayerAlongLine", "sentence": "Paint layer _PARAM6_ on _PARAM0_ from _PARAM1_; _PARAM2_ to _PARAM3_; _PARAM4_ with a radius of _PARAM5_", "events": [ @@ -5226,8 +5505,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the start", @@ -5251,9 +5530,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance from the line.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance from the line." + "type": "expression" }, { "description": "Layer (1 to 4)", @@ -5261,13 +5540,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Paint a layer on the ground along a line, for example for a path or a road.", - "group": "Paint" + "objectGroups": [] }, { + "description": "Tint the ground around a position with a color multiplying its layers, like dry grass or darker mud. White removes the tint.", "fullName": "Tint the ground", "functionType": "Action", + "group": "Paint", "name": "TintGround", "sentence": "Tint the ground of _PARAM0_ with _PARAM4_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -5291,8 +5570,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5306,9 +5585,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance." + "type": "expression" }, { "description": "Color", @@ -5316,13 +5595,13 @@ "type": "color" } ], - "objectGroups": [], - "description": "Tint the ground around a position with a color multiplying its layers, like dry grass or darker mud. White removes the tint.", - "group": "Paint" + "objectGroups": [] }, { + "description": "Make the ground around a position wet (darker and shiny, like after rain or near water) or dry.", "fullName": "Change the wetness of the ground", "functionType": "Action", + "group": "Paint", "name": "WetGround", "sentence": "Change the wetness of the ground of _PARAM0_ to _PARAM4_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -5346,8 +5625,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5361,9 +5640,9 @@ }, { "description": "Radius", + "longDescription": "The effect fades out smoothly up to this distance.", "name": "Radius", - "type": "expression", - "longDescription": "The effect fades out smoothly up to this distance." + "type": "expression" }, { "description": "Wetness (from 0 for dry to 1)", @@ -5371,13 +5650,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Make the ground around a position wet (darker and shiny, like after rain or near water) or dry.", - "group": "Paint" + "objectGroups": [] }, { + "description": "the wetness of the ground at a position, from 0 (dry) to 1, painted or near the water (wet shore).", "fullName": "Ground wetness", "functionType": "ExpressionAndCondition", + "group": "Paint", "name": "GroundWetness", "sentence": "the wetness of the ground at _PARAM1_; _PARAM2_", "events": [ @@ -5395,12 +5674,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position", @@ -5413,16 +5695,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "the wetness of the ground at a position, from 0 (dry) to 1, painted or near the water (wet shore).", - "group": "Paint", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "The tint painted on the ground at a position, like \"255;255;255\" (white when there is none).", "fullName": "Ground tint", "functionType": "StringExpression", + "group": "Paint", "name": "GroundTint", "sentence": "", "events": [ @@ -5440,12 +5719,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "string" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position", @@ -5458,16 +5740,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "The tint painted on the ground at a position, like \"255;255;255\" (white when there is none).", - "group": "Paint", - "expressionType": { - "type": "string" - } + "objectGroups": [] }, { + "description": "Remove the ground in a circle, for the entrance of a tunnel, a cave or a well: there is nothing drawn and no collision there. Fill it again with the \"Fill holes\" action. A height field can't go under itself: put a 3D model (with a collision shape) for the tunnel or the cave under the ground. The physics engine removes the triangles touching a hole, so the hole in the collisions can be up to a cell larger than the one drawn: make the model go a bit further than the hole, or put rocks around the entrance.", "fullName": "Make a hole", "functionType": "Action", + "group": "Holes", "name": "MakeHole", "sentence": "Make a hole in _PARAM0_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -5490,8 +5769,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5509,13 +5788,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Remove the ground in a circle, for the entrance of a tunnel, a cave or a well: there is nothing drawn and no collision there. Fill it again with the \"Fill holes\" action. A height field can't go under itself: put a 3D model (with a collision shape) for the tunnel or the cave under the ground. The physics engine removes the triangles touching a hole, so the hole in the collisions can be up to a cell larger than the one drawn: make the model go a bit further than the hole, or put rocks around the entrance.", - "group": "Holes" + "objectGroups": [] }, { + "description": "Fill the holes in a circle with the layers of the ground around them: the ground is drawn and has collisions again.", "fullName": "Fill holes", "functionType": "Action", + "group": "Holes", "name": "FillHoles", "sentence": "Fill the holes in _PARAM0_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -5538,8 +5817,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5557,13 +5836,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Fill the holes in a circle with the layers of the ground around them: the ground is drawn and has collisions again.", - "group": "Holes" + "objectGroups": [] }, { + "description": "Make the entrance of a tunnel or a cave on a slope: a hole, with the ground in front of it flattened to the floor of the tunnel.", "fullName": "Carve an entrance", "functionType": "Action", + "group": "Holes", "name": "CarveEntrance", "sentence": "Carve an entrance in _PARAM0_ at _PARAM1_; _PARAM2_ with a radius of _PARAM3_, going in at _PARAM4_° with its floor at Z _PARAM5_ and _PARAM6_ pixels of flat ground in front", "events": [ @@ -5589,8 +5868,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position of the center", @@ -5623,13 +5902,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Make the entrance of a tunnel or a cave on a slope: a hole, with the ground in front of it flattened to the floor of the tunnel.", - "group": "Holes" + "objectGroups": [] }, { + "description": "Check if there is a hole in the ground at a position.", "fullName": "Hole", "functionType": "Condition", + "group": "Holes", "name": "IsHole", "sentence": "There is a hole in _PARAM0_ at _PARAM1_; _PARAM2_", "events": [ @@ -5651,8 +5930,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position", @@ -5665,13 +5944,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Check if there is a hole in the ground at a position.", - "group": "Holes" + "objectGroups": [] }, { + "description": "The Z position of the ground at a position, or the given value where there is a hole.", "fullName": "Ground Z position, with holes", "functionType": "Expression", + "group": "Holes", "name": "GroundZWithHoles", "sentence": "", "events": [ @@ -5690,12 +5969,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position", @@ -5709,21 +5991,18 @@ }, { "description": "Value in holes", + "longDescription": "For example, a Z position far under the ground.", "name": "ZInHoles", - "type": "expression", - "longDescription": "For example, a Z position far under the ground." + "type": "expression" } ], - "objectGroups": [], - "description": "The Z position of the ground at a position, or the given value where there is a hole.", - "group": "Holes", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "Replace the ground with a generated relief. Painted layers are reset.", "fullName": "Generate a relief", "functionType": "Action", + "group": "Generation", "name": "GenerateRelief", "sentence": "Generate a relief of _PARAM1_ on _PARAM0_ with seed _PARAM2_", "events": [ @@ -5745,29 +6024,29 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "Relief", "name": "Relief", - "type": "stringWithSelector", - "supplementaryInformation": "[\"Flat\", \"Hills\", \"Mountains\", \"Island\"]" + "supplementaryInformation": "[\"Flat\", \"Hills\", \"Mountains\", \"Island\"]", + "type": "stringWithSelector" }, { "description": "Seed", + "longDescription": "Each seed gives a different terrain with the same relief.", "name": "Seed", - "type": "expression", - "longDescription": "Each seed gives a different terrain with the same relief." + "type": "expression" } ], - "objectGroups": [], - "description": "Replace the ground with a generated relief. Painted layers are reset.", - "group": "Generation" + "objectGroups": [] }, { + "description": "Replace the ground with the heights of an image. Painted layers are kept.", "fullName": "Load a heightmap", "functionType": "Action", + "group": "Generation", "name": "LoadHeightmap", "sentence": "Load the heights of _PARAM0_ from _PARAM1_", "events": [ @@ -5788,23 +6067,23 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "Heightmap image", + "longDescription": "Black is the lowest, white the highest. For more precision, store the height on 16 bits in the red (most significant byte) and green channels.", "name": "Image", - "type": "imageResource", - "longDescription": "Black is the lowest, white the highest. For more precision, store the height on 16 bits in the red (most significant byte) and green channels." + "type": "imageResource" } ], - "objectGroups": [], - "description": "Replace the ground with the heights of an image. Painted layers are kept.", - "group": "Generation" + "objectGroups": [] }, { + "description": "Move objects up or down so that their bottom is on the ground, under their center. Useful to place trees, rocks or characters on a terrain.", "fullName": "Put objects on the ground", "functionType": "Action", + "group": "Position", "name": "PutOnGround", "sentence": "Put _PARAM1_ on the ground of _PARAM0_", "events": [ @@ -5824,8 +6103,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "Objects to put on the ground", @@ -5833,13 +6112,13 @@ "type": "objectList" } ], - "objectGroups": [], - "description": "Move objects up or down so that their bottom is on the ground, under their center. Useful to place trees, rocks or characters on a terrain.", - "group": "Position" + "objectGroups": [] }, { + "description": "the Z position of the ground at a position of the scene.", "fullName": "Ground Z position", "functionType": "ExpressionAndCondition", + "group": "Position", "name": "GroundZ", "sentence": "the ground Z position at _PARAM1_; _PARAM2_", "events": [ @@ -5857,12 +6136,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position", @@ -5875,16 +6157,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "the Z position of the ground at a position of the scene.", - "group": "Position", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "the slope of the ground (angle with the horizontal, in degrees) at a position of the scene.", "fullName": "Ground slope", "functionType": "ExpressionAndCondition", + "group": "Position", "name": "GroundSlope", "sentence": "the ground slope at _PARAM1_; _PARAM2_", "events": [ @@ -5902,12 +6181,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position", @@ -5920,16 +6202,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "the slope of the ground (angle with the horizontal, in degrees) at a position of the scene.", - "group": "Position", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "the layer (from 1 to 4) painted the most at a position of the scene. Useful to play footstep sounds or to slow down characters in water or mud.", "fullName": "Ground layer", "functionType": "ExpressionAndCondition", + "group": "Paint", "name": "GroundLayer", "sentence": "the ground layer at _PARAM1_; _PARAM2_", "events": [ @@ -5947,12 +6226,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::Terrain3D" + "supplementaryInformation": "Terrain3D::Terrain3D", + "type": "object" }, { "description": "X position", @@ -5965,14 +6247,114 @@ "type": "expression" } ], - "objectGroups": [], - "description": "the layer (from 1 to 4) painted the most at a position of the scene. Useful to play footstep sounds or to slow down characters in water or mud.", - "group": "Paint", - "expressionType": { - "type": "expression" - } + "objectGroups": [] } ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "onCreated" + }, + { + "functionName": "onDestroy" + }, + { + "functionName": "doStepPostEvents" + }, + { + "functionName": "onHotReloading" + }, + { + "folderName": "Sculpt", + "children": [ + { + "functionName": "RaiseGround" + }, + { + "functionName": "RaiseGroundAlongLine" + }, + { + "functionName": "FlattenGround" + }, + { + "functionName": "SmoothGround" + } + ] + }, + { + "folderName": "Paint", + "children": [ + { + "functionName": "PaintLayer" + }, + { + "functionName": "PaintLayerAlongLine" + }, + { + "functionName": "TintGround" + }, + { + "functionName": "WetGround" + }, + { + "functionName": "GroundWetness" + }, + { + "functionName": "GroundTint" + }, + { + "functionName": "GroundLayer" + } + ] + }, + { + "folderName": "Holes", + "children": [ + { + "functionName": "MakeHole" + }, + { + "functionName": "FillHoles" + }, + { + "functionName": "CarveEntrance" + }, + { + "functionName": "IsHole" + }, + { + "functionName": "GroundZWithHoles" + } + ] + }, + { + "folderName": "Generation", + "children": [ + { + "functionName": "GenerateRelief" + }, + { + "functionName": "LoadHeightmap" + } + ] + }, + { + "folderName": "Position", + "children": [ + { + "functionName": "PutOnGround" + }, + { + "functionName": "GroundZ" + }, + { + "functionName": "GroundSlope" + } + ] + } + ] + }, "propertyDescriptors": [ { "value": "Hills", @@ -6017,6 +6399,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "HeightmapImage" }, { @@ -6074,6 +6457,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer1Texture" }, { @@ -6085,6 +6469,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer1NormalMap" }, { @@ -6103,6 +6488,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer2Texture" }, { @@ -6114,6 +6500,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer2NormalMap" }, { @@ -6132,6 +6519,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer3Texture" }, { @@ -6143,6 +6531,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer3NormalMap" }, { @@ -6161,6 +6550,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer4Texture" }, { @@ -6172,6 +6562,7 @@ "extraInformation": [ "image" ], + "choices": [], "name": "Layer4NormalMap" }, { @@ -6185,8 +6576,8 @@ { "value": "256", "type": "Number", - "label": "Texture size", "unit": "Pixel", + "label": "Texture size", "description": "The size, in the scene, of one repetition of the layer textures.", "group": "Layers", "name": "TextureSize" @@ -6266,8 +6657,8 @@ { "value": "45", "type": "Number", - "label": "Steep slope angle", "unit": "DegreeAngle", + "label": "Steep slope angle", "group": "Layers", "name": "CliffAngle" }, @@ -6324,7 +6715,122 @@ "advanced": true, "name": "SculptData" } - ] + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "folderName": "Shape", + "children": [ + { + "propertyName": "Relief" + }, + { + "propertyName": "Seed" + }, + { + "propertyName": "HeightmapImage" + }, + { + "propertyName": "Edits" + }, + { + "propertyName": "Resolution" + } + ] + }, + { + "folderName": "Layers", + "children": [ + { + "propertyName": "Layer1Color" + }, + { + "propertyName": "Layer1Texture" + }, + { + "propertyName": "Layer1NormalMap" + }, + { + "propertyName": "Layer2Color" + }, + { + "propertyName": "Layer2Texture" + }, + { + "propertyName": "Layer2NormalMap" + }, + { + "propertyName": "Layer3Color" + }, + { + "propertyName": "Layer3Texture" + }, + { + "propertyName": "Layer3NormalMap" + }, + { + "propertyName": "Layer4Color" + }, + { + "propertyName": "Layer4Texture" + }, + { + "propertyName": "Layer4NormalMap" + }, + { + "propertyName": "NormalMapStrength" + }, + { + "propertyName": "TextureSize" + }, + { + "propertyName": "HeightBlending" + }, + { + "propertyName": "TextureVariation" + }, + { + "propertyName": "CliffLayer" + }, + { + "propertyName": "CliffAngle" + } + ] + }, + { + "folderName": "Wetness", + "children": [ + { + "propertyName": "WetShore" + }, + { + "propertyName": "WetShoreZ" + }, + { + "propertyName": "WetShoreFade" + } + ] + }, + { + "folderName": "Rendering", + "children": [ + { + "propertyName": "CastShadow" + }, + { + "propertyName": "ReceiveShadow" + }, + { + "propertyName": "Anisotropy" + } + ] + }, + { + "propertyName": "SculptData" + } + ] + } }, { "areaMaxX": 1000, @@ -6336,6 +6842,7 @@ "defaultName": "Grass", "description": "A field of grass blades swaying in the wind and pushed aside by characters. They grow in the area of the object, on the highest 3D terrain at each point (one field can cover several terrains), or at the Z position of the object where there is no terrain.", "fullName": "Terrain grass", + "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0zIDIxYzEtNSAxLTkgMC0xMyAyIDMgMyA3IDMgMTN6bTQgMGMwLTYgMS0xMSA0LTE2LTEgNS0xIDEwIDAgMTZ6bTUgMGMwLTUgMi05IDUtMTItMiA0LTIgOC0xIDEyem01IDBjMS00IDItNiA0LTgtMSAzLTEgNS0xIDh6Ii8+PC9zdmc+", "is3D": true, "isUsingLegacyInstancesRenderer": true, @@ -6423,16 +6930,15 @@ { "angle": 0, "customSize": true, - "width": 1000, - "height": 1000, "depth": 40, + "height": 1000, "keepRatio": true, "layer": "", "name": "AreaPlaceholder", "persistentUuid": "5d7a8b1e-3c2f-4e6a-9b1d-001000001000", + "width": 1000, "x": 0, "y": 0, - "z": 0, "zOrder": 1, "numberProperties": [], "stringProperties": [], @@ -6497,8 +7003,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::TerrainGrass" + "supplementaryInformation": "Terrain3D::TerrainGrass", + "type": "object" } ], "objectGroups": [] @@ -6525,8 +7031,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::TerrainGrass" + "supplementaryInformation": "Terrain3D::TerrainGrass", + "type": "object" } ], "objectGroups": [] @@ -6561,8 +7067,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::TerrainGrass" + "supplementaryInformation": "Terrain3D::TerrainGrass", + "type": "object" } ], "objectGroups": [] @@ -6589,13 +7095,30 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::TerrainGrass" + "supplementaryInformation": "Terrain3D::TerrainGrass", + "type": "object" } ], "objectGroups": [] } ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "onCreated" + }, + { + "functionName": "onDestroy" + }, + { + "functionName": "doStepPostEvents" + }, + { + "functionName": "onHotReloading" + } + ] + }, "propertyDescriptors": [ { "value": "60", @@ -6608,8 +7131,8 @@ { "value": "36", "type": "Number", - "label": "Blade height", "unit": "Pixel", + "label": "Blade height", "description": "The average height of blades (each blade is between 60% and 140% of it).", "group": "Blades", "name": "BladeHeight" @@ -6617,8 +7140,8 @@ { "value": "5", "type": "Number", - "label": "Blade width", "unit": "Pixel", + "label": "Blade width", "group": "Blades", "name": "BladeWidth" }, @@ -6677,8 +7200,8 @@ { "value": "40", "type": "Number", - "label": "Maximum slope", "unit": "DegreeAngle", + "label": "Maximum slope", "description": "No blades grow on steeper ground.", "group": "Ground", "name": "MaxSlope" @@ -6709,13 +7232,74 @@ { "value": "2500", "type": "Number", - "label": "Fade distance", "unit": "Pixel", + "label": "Fade distance", "description": "Blades are less and less dense up to this distance from the camera, and hidden after.", "group": "Rendering", "name": "FadeDistance" } - ] + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "folderName": "Blades", + "children": [ + { + "propertyName": "Density" + }, + { + "propertyName": "BladeHeight" + }, + { + "propertyName": "BladeWidth" + }, + { + "propertyName": "BaseColor" + }, + { + "propertyName": "TipColor" + }, + { + "propertyName": "Seed" + } + ] + }, + { + "folderName": "Ground", + "children": [ + { + "propertyName": "GroundLayer" + }, + { + "propertyName": "MaxSlope" + } + ] + }, + { + "folderName": "Wind", + "children": [ + { + "propertyName": "WindStrength" + }, + { + "propertyName": "WindSpeed" + }, + { + "propertyName": "BendingObject" + } + ] + }, + { + "folderName": "Rendering", + "children": [ + { + "propertyName": "FadeDistance" + } + ] + } + ] + } }, { "areaMaxX": 2000, @@ -6724,10 +7308,11 @@ "areaMinX": 0, "areaMinY": 0, "areaMinZ": 0, - "defaultName": "ScatteredModels", "assetStoreTag": "3d scattered models", + "defaultName": "ScatteredModels", "description": "Many copies of a 3D model (trees, rocks, bushes, flowers...) placed in the area of the object and drawn all at once, which is much faster than an object for each one. They stand on the highest 3D terrain at each point, or at the Z position of the object where there is no terrain. Paint where they grow with the brushes of the scene editor.", "fullName": "Scattered models (forests, rocks...)", + "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMCAyMXYtM0gzbDUtNUg1bDUtNUg3bDUtNSA1IDVoLTNsNSA1aC0zbDUgNWgtN3YzeiIvPjwvc3ZnPg==", "is3D": true, "isUsingLegacyInstancesRenderer": true, @@ -6737,6 +7322,7 @@ { "assetStoreId": "", "name": "AreaPlaceholder", + "persistentUuid": "06ba5ea9-2e29-4867-90ba-dd3268867171", "type": "Scene3D::Cube3DObject", "variables": [], "effects": [], @@ -6815,23 +7401,38 @@ { "angle": 0, "customSize": true, - "width": 2000, - "height": 2000, "depth": 200, + "height": 2000, "keepRatio": true, "layer": "", "name": "AreaPlaceholder", "persistentUuid": "5d7a8b1e-3c2f-4e6a-9b1d-002000002000", + "width": 2000, "x": 0, "y": 0, - "z": 0, "zOrder": 1, "numberProperties": [], "stringProperties": [], "initialVariables": [] } ], - "editionSettings": {}, + "editionSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.35, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, "eventsFunctions": [ { "fullName": "", @@ -6889,8 +7490,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" } ], "objectGroups": [] @@ -6917,8 +7518,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" } ], "objectGroups": [] @@ -6949,8 +7550,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" } ], "objectGroups": [] @@ -6977,15 +7578,17 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" } ], "objectGroups": [] }, { + "description": "Paint the density of copies around a position, up to the density of the object (copies removed with \"Erase copies\" come back). The effect fades out up to the radius.", "fullName": "Add copies", "functionType": "Action", + "group": "Paint", "name": "AddCopies", "sentence": "Add copies of _PARAM0_ around _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -7008,8 +7611,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" }, { "description": "X position of the center", @@ -7027,13 +7630,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Paint the density of copies around a position, up to the density of the object (copies removed with \"Erase copies\" come back). The effect fades out up to the radius.", - "group": "Paint" + "objectGroups": [] }, { + "description": "Remove the copies standing in a circle, for example a tree cut by the player (use the position of the nearest copy and a small radius) or a forest cleared for a building. They come back when the scene is restarted.", "fullName": "Erase copies", "functionType": "Action", + "group": "Paint", "name": "EraseCopies", "sentence": "Erase the copies of _PARAM0_ in a circle at _PARAM1_; _PARAM2_ with a radius of _PARAM3_", "events": [ @@ -7056,8 +7659,8 @@ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" }, { "description": "X position of the center", @@ -7075,13 +7678,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "Remove the copies standing in a circle, for example a tree cut by the player (use the position of the nearest copy and a small radius) or a forest cleared for a building. They come back when the scene is restarted.", - "group": "Paint" + "objectGroups": [] }, { + "description": "the number of copies placed in the area.", "fullName": "Number of copies", "functionType": "ExpressionAndCondition", + "group": "Copies", "name": "CopyCount", "sentence": "the number of copies", "events": [ @@ -7097,24 +7700,24 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" } ], - "objectGroups": [], - "description": "the number of copies placed in the area.", - "group": "Copies", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "The X position of the base of the copy nearest to a position (the position itself if there is no copy).", "fullName": "X position of the nearest copy", "functionType": "Expression", + "group": "Copies", "name": "NearestCopyX", "sentence": "", "events": [ @@ -7133,12 +7736,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" }, { "description": "X position", @@ -7151,16 +7757,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "The X position of the base of the copy nearest to a position (the position itself if there is no copy).", - "group": "Copies", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "The Y position of the base of the copy nearest to a position (the position itself if there is no copy).", "fullName": "Y position of the nearest copy", "functionType": "Expression", + "group": "Copies", "name": "NearestCopyY", "sentence": "", "events": [ @@ -7179,12 +7782,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" }, { "description": "X position", @@ -7197,16 +7803,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "The Y position of the base of the copy nearest to a position (the position itself if there is no copy).", - "group": "Copies", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "The Z position of the base of the copy nearest to a position (on the ground).", "fullName": "Z position of the nearest copy", "functionType": "Expression", + "group": "Copies", "name": "NearestCopyZ", "sentence": "", "events": [ @@ -7222,15 +7825,18 @@ ], "parameterObjects": "Object", "useStrict": true, - "eventsSheetExpanded": false + "eventsSheetExpanded": true } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" }, { "description": "X position", @@ -7243,16 +7849,13 @@ "type": "expression" } ], - "objectGroups": [], - "description": "The Z position of the base of the copy nearest to a position (on the ground).", - "group": "Copies", - "expressionType": { - "type": "expression" - } + "objectGroups": [] }, { + "description": "the distance (on X and Y) from a position to the base of the nearest copy. It's a very big number when there is no copy.", "fullName": "Distance to the nearest copy", "functionType": "ExpressionAndCondition", + "group": "Copies", "name": "NearestCopyDistance", "sentence": "the distance from _PARAM1_; _PARAM2_ to the nearest copy", "events": [ @@ -7271,12 +7874,15 @@ "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "type": "object", - "supplementaryInformation": "Terrain3D::ScatteredModels" + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" }, { "description": "X position", @@ -7289,34 +7895,214 @@ "type": "expression" } ], - "objectGroups": [], - "description": "the distance (on X and Y) from a position to the base of the nearest copy. It's a very big number when there is no copy.", + "objectGroups": [] + }, + { + "description": "The angle (in degrees, around the Z axis) of the copy nearest to a position (0 when there is no copy).", + "fullName": "Angle of the nearest copy", + "functionType": "Expression", "group": "Copies", + "name": "NearestCopyAngle", + "sentence": "", + "events": [ + { + "aiGeneratedEventId": "01M6W13A1GCBRR93J2V6ZPRBYZ", + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject3D} */", + "const object = objects[0];", + "const x = eventsFunctionContext.getArgument(\"X\");", + "const y = eventsFunctionContext.getArgument(\"Y\");", + "const copy = object.__terrainScatter.findNearestCopy(x, y);", + "eventsFunctionContext.returnValue = copy ? (copy.angle * 180) / Math.PI : 0;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], "expressionType": { "type": "expression" - } + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" + }, + { + "description": "X position", + "name": "X", + "type": "expression" + }, + { + "description": "Y position", + "name": "Y", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "The scale factor of the copy nearest to a position (1 = the model at its original size, 0 when there is no copy).", + "fullName": "Scale of the nearest copy", + "functionType": "Expression", + "group": "Copies", + "name": "NearestCopyScale", + "sentence": "", + "events": [ + { + "aiGeneratedEventId": "01M6W15Y2Y5KXQHWMS0ZX3RSMT", + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject3D} */", + "const object = objects[0];", + "const x = eventsFunctionContext.getArgument(\"X\");", + "const y = eventsFunctionContext.getArgument(\"Y\");", + "const copy = object.__terrainScatter.findNearestCopy(x, y);", + "eventsFunctionContext.returnValue = copy ? copy.scale : 0;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Terrain3D::ScatteredModels", + "type": "object" + }, + { + "description": "X position", + "name": "X", + "type": "expression" + }, + { + "description": "Y position", + "name": "Y", + "type": "expression" + } + ], + "objectGroups": [] } ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "onCreated" + }, + { + "functionName": "onDestroy" + }, + { + "functionName": "doStepPostEvents" + }, + { + "functionName": "onHotReloading" + }, + { + "folderName": "Paint", + "children": [ + { + "functionName": "AddCopies" + }, + { + "functionName": "EraseCopies" + } + ] + }, + { + "folderName": "Copies", + "children": [ + { + "functionName": "CopyCount" + }, + { + "functionName": "NearestCopyX" + }, + { + "functionName": "NearestCopyY" + }, + { + "functionName": "NearestCopyZ" + }, + { + "functionName": "NearestCopyDistance" + }, + { + "functionName": "NearestCopyAngle" + }, + { + "functionName": "NearestCopyScale" + } + ] + } + ] + }, "propertyDescriptors": [ { "value": "", "type": "Resource", "label": "3D model", - "description": "The model copied everywhere (a .glb file). Models standing on the Y axis, like most models of the asset store, are stood up along Z.", + "description": "The model copied everywhere (a .glb file).", "group": "Model", "extraInformation": [ "model3D" ], + "choices": [], "name": "Model" }, { - "value": "300", + "value": "Y", + "type": "Choice", + "label": "Model up axis", + "description": "The axis the model stands on in the file. Most models of the asset store stand on Y, they are stood up along Z.", + "group": "Model", + "choices": [ + { + "label": "Y (like most models)", + "value": "Y" + }, + { + "label": "Z (like the scene)", + "value": "Z" + } + ], + "name": "ModelUpAxis" + }, + { + "value": "ModelOrigin", + "type": "Choice", + "label": "Point put on the ground", + "description": "The point of the model put on the ground, also at the center of the trunk collision. Use the origin of the model when the trunk is not at the center of the model (asymmetric canopy, leaning tree), or to sink the base of copies in the ground on slopes.", + "group": "Model", + "choices": [ + { + "label": "Center of the model base", + "value": "BaseCenter" + }, + { + "label": "Origin of the model", + "value": "ModelOrigin" + } + ], + "name": "ModelAnchor" + }, + { + "value": "100", "type": "Number", - "label": "Height of a copy", - "unit": "Pixel", - "description": "Copies keep the proportions of the model.", + "unit": "Dimensionless", + "label": "Scale factor of a copy", + "description": "The size of a copy, in percent of the original model size (100 = the model at its original size, like a 3D model object with a scale of 1). Copies keep the proportions of the model.", "group": "Model", - "name": "Size" + "name": "ScaleFactor" }, { "value": "0.8", @@ -7416,8 +8202,8 @@ { "value": "30", "type": "Number", - "label": "Maximum slope", "unit": "DegreeAngle", + "label": "Maximum slope", "description": "No copies grow on steeper ground.", "group": "Ground", "name": "MaxSlope" @@ -7425,8 +8211,8 @@ { "value": "-100000", "type": "Number", - "label": "Minimum ground Z", "unit": "Pixel", + "label": "Minimum ground Z", "description": "No copies grow where the ground is lower (for example, under the water level).", "group": "Ground", "name": "MinGroundZ" @@ -7434,8 +8220,8 @@ { "value": "100000", "type": "Number", - "label": "Maximum ground Z", "unit": "Pixel", + "label": "Maximum ground Z", "description": "No copies grow where the ground is higher (for example, above the tree line).", "group": "Ground", "name": "MaxGroundZ" @@ -7451,17 +8237,17 @@ { "value": "30", "type": "Number", - "label": "Trunk diameter", "unit": "Pixel", - "description": "The diameter of the collision shape of a copy at the height given in \"Height of a copy\" (it is scaled with the copy).", + "label": "Trunk diameter", + "description": "The diameter of the collision shape of a copy at the scale given in \"Scale factor of a copy\" (it is scaled with the copy).", "group": "Collisions", "name": "TrunkDiameter" }, { "value": "8000", "type": "Number", - "label": "Draw distance", "unit": "Pixel", + "label": "Draw distance", "description": "Copies shrink and are hidden at this distance from the camera.", "group": "Rendering", "name": "DrawDistance" @@ -7497,7 +8283,103 @@ "advanced": true, "name": "PaintData" } - ] + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "folderName": "Model", + "children": [ + { + "propertyName": "Model" + }, + { + "propertyName": "ModelUpAxis" + }, + { + "propertyName": "ModelAnchor" + }, + { + "propertyName": "ScaleFactor" + }, + { + "propertyName": "MinScale" + }, + { + "propertyName": "MaxScale" + }, + { + "propertyName": "RandomRotation" + }, + { + "propertyName": "RandomTint" + } + ] + }, + { + "folderName": "Placement", + "children": [ + { + "propertyName": "Density" + }, + { + "propertyName": "Seed" + }, + { + "propertyName": "Coverage" + }, + { + "propertyName": "Edits" + } + ] + }, + { + "folderName": "Ground", + "children": [ + { + "propertyName": "GroundLayer" + }, + { + "propertyName": "MaxSlope" + }, + { + "propertyName": "MinGroundZ" + }, + { + "propertyName": "MaxGroundZ" + } + ] + }, + { + "folderName": "Collisions", + "children": [ + { + "propertyName": "TrunkCollisions" + }, + { + "propertyName": "TrunkDiameter" + } + ] + }, + { + "folderName": "Rendering", + "children": [ + { + "propertyName": "DrawDistance" + }, + { + "propertyName": "CastShadow" + }, + { + "propertyName": "ReceiveShadow" + } + ] + }, + { + "propertyName": "PaintData" + } + ] + } } ] } From 330690e8d0a1453781a74a7b800ba310f45b602b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Mon, 9 Nov 2026 17:34:47 +0100 Subject: [PATCH 2/8] Restore the store metadata of Terrain3D Put back the official short description and the store origin, replaced by the ones of a local editable copy. --- extensions/reviewed/Terrain3D.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index 946b7e51b..f816229cd 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -9,7 +9,7 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXRlcnJhaW4iIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTQsNkwxMC4yNSwxMUwxMy4xLDE0LjhMMTEuNSwxNkM5LjgxLDEzLjc1IDcsMTAgNywxMEwxLDE4SDIzTDE0LDZaIiAvPjwvc3ZnPg==", "name": "Terrain3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/10e0a26c0d500830dfe23b94138beb0ef61607ba62bca05a5aa5c849777f1b06_terrain.svg", - "shortDescription": "Editable copy of Terrain3D with the ModelUpAxis/ModelAnchor fix and new copy expressions.", + "shortDescription": "A ground with hills and valleys that can be sculpted and painted in the editor, with collisions.", "version": "0.3.1", "description": [ "A 3D terrain object for open worlds, adventure or racing games: hills, mountains, islands or valleys, with painted layers of grass, dirt, rock or sand.", @@ -27,6 +27,10 @@ "- **Tunnels and caves**: make holes in the ground (and fill them again) with the brushes, the Edits property or actions, and put a 3D model of the tunnel or the cave (with a mesh collision shape) under the ground. Nothing is drawn in holes, and characters, cars and rays go through them.", "- **Made for large worlds**: the terrain is split in chunks that are hidden when off-screen and simplified when far away, and collisions are updated only where the ground changes." ], + "origin": { + "identifier": "Terrain3D", + "name": "gdevelop-extension-store" + }, "tags": [ "3d", "terrain", From b47ecca3751b9367f21736e43f0010aacf341d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Mon, 9 Nov 2026 17:34:47 +0100 Subject: [PATCH 3/8] Create the replacing object on the layer of the scattered models ReplaceNearestCopyWithObject created the object on the base layer. --- extensions/reviewed/Terrain3D.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index f816229cd..0d83a6c11 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -4814,7 +4814,7 @@ "ObjectToCreate", "CopyX", "CopyY", - "\"\"" + "ScatterObject.Layer()" ] }, { From f5e296d8468aa8d4fccb848782f8185e67f2e8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Mon, 9 Nov 2026 17:34:47 +0100 Subject: [PATCH 4/8] Rename naturalHeight to sourceHeight in scattered models It is the height in the model file units, while the other sizes are relative to a height of 1. --- extensions/reviewed/Terrain3D.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index 0d83a6c11..0bc95e10f 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -3709,7 +3709,7 @@ " */", "", "/** @type {ModelParts} */", - "const emptyModelParts = { parts: [], width: 0, depth: 0, bottom: 0, top: 1, reach: 0, naturalHeight: 1 };", + "const emptyModelParts = { parts: [], width: 0, depth: 0, bottom: 0, top: 1, reach: 0, sourceHeight: 1 };", "", "/**", " * The parts of a model, ready to be drawn with instancing: each glTF", @@ -3780,9 +3780,10 @@ " const material = Array.isArray(mesh.material) ? mesh.material.map(patchMaterial) : patchMaterial(mesh.material);", " return { geometry, material };", " });", + " // The sizes are relative to a height of 1, except sourceHeight which is in the model file units.", " return {", " parts,", - " naturalHeight: height,", + " sourceHeight: height,", " width: (box.max.x - box.min.x) / height,", " depth: (box.max.y - box.min.y) / height,", " bottom: normalizedBox.min.z,", @@ -4035,7 +4036,7 @@ " const copyScale =", " (Math.max(object._getScaleFactor(), 0) / 100) *", " (object._getMinScale() + (object._getMaxScale() - object._getMinScale()) * scaleFactor);", - " const copyHeight = copyScale * this.model.naturalHeight * 100;", + " const copyHeight = copyScale * this.model.sourceHeight * 100;", " if (ground) {", " if (ground.getSlopeAt(sceneX, sceneY) > object._getMaxSlope()) return null;", " const groundLayer = parseInt(object._getGroundLayer(), 10) || 0;", From 62cee049cf42b71665e5bbb968f46226645412ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Mon, 9 Nov 2026 17:34:48 +0100 Subject: [PATCH 5/8] Keep the height of scattered models made before the scale factor The Size property is back as a deprecated property, 0 by default. When it is greater than 0 (objects made with v0.2.0), copies keep this fixed height and their trunk collisions as before. Otherwise, the scale factor is used. NearestCopyScale works in both cases. --- extensions/reviewed/Terrain3D.json | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index 0bc95e10f..a85f7b4fd 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -3985,7 +3985,7 @@ " const { object } = this;", " return [", " object.getX(), object.getY(), object.getZ(), object.getWidth(), object.getHeight(), object.getDepth(),", - " object._getDensity(), object._getScaleFactor(), object._getMinScale(), object._getMaxScale(),", + " object._getDensity(), object._getSize(), object._getScaleFactor(), object._getMinScale(), object._getMaxScale(),", " object._getRandomRotation(), object._getRandomTint(), object._getGroundLayer(), object._getMaxSlope(),", " object._getMinGroundZ(), object._getMaxGroundZ(), object._getSeed(), object._getDrawDistance(),", " object._getCastShadow(), object._getReceiveShadow(), this.model.parts.length,", @@ -4033,10 +4033,15 @@ " const { ground, z } = findHighestGround(grounds, sceneX, sceneY, this._groundAtCopy);", " const groundZ = ground ? z : object.getZ();", " if (groundZ < object._getMinGroundZ() || groundZ > object._getMaxGroundZ()) return null;", - " const copyScale =", - " (Math.max(object._getScaleFactor(), 0) / 100) *", - " (object._getMinScale() + (object._getMaxScale() - object._getMinScale()) * scaleFactor);", - " const copyHeight = copyScale * this.model.sourceHeight * 100;", + " const randomScale = object._getMinScale() + (object._getMaxScale() - object._getMinScale()) * scaleFactor;", + " const sourceHeightInPixels = this.model.sourceHeight * 100;", + " // Objects made before \"Scale factor of a copy\" keep their fixed height (deprecated \"Size\" property).", + " const legacyHeight = object._getSize();", + " const copyHeight =", + " legacyHeight > 0", + " ? legacyHeight * randomScale", + " : (Math.max(object._getScaleFactor(), 0) / 100) * randomScale * sourceHeightInPixels;", + " const copyScale = copyHeight / sourceHeightInPixels;", " if (ground) {", " if (ground.getSlopeAt(sceneX, sceneY) > object._getMaxSlope()) return null;", " const groundLayer = parseInt(object._getGroundLayer(), 10) || 0;", @@ -4404,7 +4409,9 @@ " const depth = object.getDepth() || 1;", " let indexOffset = 0;", " copies.forEach((copy, copyIndex) => {", - " const radius = (Math.max(object._getTrunkDiameter(), 0) / 2) * copy.scale;", + " const legacyHeight = object._getSize();", + " const trunkScale = legacyHeight > 0 ? copy.height / legacyHeight : copy.scale;", + " const radius = (Math.max(object._getTrunkDiameter(), 0) / 2) * trunkScale;", " // Up to 80% of the model height, at least a bit above the ground.", " const top = copy.z + copy.height * Math.max(this.model.bottom + 0.8, 0.1);", " const firstVertex = copyIndex * verticesPerCopy;", @@ -8109,6 +8116,16 @@ "group": "Model", "name": "ScaleFactor" }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Height of a copy", + "description": "Kept for objects made before \"Scale factor of a copy\": when greater than 0, copies have this fixed height and the scale factor is ignored.", + "group": "Model", + "deprecated": true, + "name": "Size" + }, { "value": "0.8", "type": "Number", From c7b1224744c773afe80011f5a6da1b7151700a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Mon, 9 Nov 2026 17:34:48 +0100 Subject: [PATCH 6/8] Don't create an object when there is no copy to replace Without any copy, NearestCopyScale returns 0 and the action created an object with a size of 0 at the given position. --- extensions/reviewed/Terrain3D.json | 140 ++++++++++++++++------------- 1 file changed, 79 insertions(+), 61 deletions(-) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index a85f7b4fd..a03772a5d 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -4785,76 +4785,94 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "NumberVariable" }, "parameters": [ - "EraseTheCopy", - "True", - "" + "CopyScale", + ">", + "0" ] } ], - "actions": [ - { - "type": { - "value": "Terrain3D::ScatteredModels::EraseCopies" - }, - "parameters": [ - "ScatterObject", - "CopyX", - "CopyY", - "1", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Create" - }, - "parameters": [ - "", - "ObjectToCreate", - "CopyX", - "CopyY", - "ScatterObject.Layer()" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "Scene3D::Base3DBehavior::SetZ" - }, - "parameters": [ - "ObjectToCreate", - "Object3DBehavior", - "=", - "CopyZ" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "EraseTheCopy", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Terrain3D::ScatteredModels::EraseCopies" + }, + "parameters": [ + "ScatterObject", + "CopyX", + "CopyY", + "1", + "" + ] + } ] }, { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "ObjectToCreate", - "=", - "CopyAngle" - ] - }, - { - "type": { - "value": "ScalableCapability::ScalableBehavior::SetValue" - }, - "parameters": [ - "ObjectToCreate", - "ScaleBehavior", - "=", - "CopyScale" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "ObjectToCreate", + "CopyX", + "CopyY", + "ScatterObject.Layer()" + ] + }, + { + "type": { + "value": "Scene3D::Base3DBehavior::SetZ" + }, + "parameters": [ + "ObjectToCreate", + "Object3DBehavior", + "=", + "CopyZ" + ] + }, + { + "type": { + "value": "SetAngle" + }, + "parameters": [ + "ObjectToCreate", + "=", + "CopyAngle" + ] + }, + { + "type": { + "value": "ScalableCapability::ScalableBehavior::SetValue" + }, + "parameters": [ + "ObjectToCreate", + "ScaleBehavior", + "=", + "CopyScale" + ] + } ] } ] From e60a6f8237a6c64cbaabb717737bb41c88a50b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Tue, 10 Nov 2026 10:22:53 +0100 Subject: [PATCH 7/8] Apply the scale factor to scattered models made before it Store prefabs and older objects keep their height of a copy, now multiplied by the scale factor instead of ignoring it (100% keeps their look). --- extensions/reviewed/Terrain3D.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index a03772a5d..0757b6226 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -4035,12 +4035,11 @@ " if (groundZ < object._getMinGroundZ() || groundZ > object._getMaxGroundZ()) return null;", " const randomScale = object._getMinScale() + (object._getMaxScale() - object._getMinScale()) * scaleFactor;", " const sourceHeightInPixels = this.model.sourceHeight * 100;", - " // Objects made before \"Scale factor of a copy\" keep their fixed height (deprecated \"Size\" property).", + " // Objects made before \"Scale factor of a copy\" (store prefabs included) scale their fixed", + " // height (deprecated \"Size\" property) instead of the model height: they look the same at 100%.", " const legacyHeight = object._getSize();", - " const copyHeight =", - " legacyHeight > 0", - " ? legacyHeight * randomScale", - " : (Math.max(object._getScaleFactor(), 0) / 100) * randomScale * sourceHeightInPixels;", + " const baseHeight = legacyHeight > 0 ? legacyHeight : sourceHeightInPixels;", + " const copyHeight = (Math.max(object._getScaleFactor(), 0) / 100) * randomScale * baseHeight;", " const copyScale = copyHeight / sourceHeightInPixels;", " if (ground) {", " if (ground.getSlopeAt(sceneX, sceneY) > object._getMaxSlope()) return null;", @@ -8130,7 +8129,7 @@ "type": "Number", "unit": "Dimensionless", "label": "Scale factor of a copy", - "description": "The size of a copy, in percent of the original model size (100 = the model at its original size, like a 3D model object with a scale of 1). Copies keep the proportions of the model.", + "description": "The size of a copy, in percent of the original model size (100 = the model at its original size, like a 3D model object with a scale of 1). For objects made before this property, like the ones of the asset store, it is a percent of their former height of a copy. Copies keep the proportions of the model.", "group": "Model", "name": "ScaleFactor" }, @@ -8139,7 +8138,7 @@ "type": "Number", "unit": "Pixel", "label": "Height of a copy", - "description": "Kept for objects made before \"Scale factor of a copy\": when greater than 0, copies have this fixed height and the scale factor is ignored.", + "description": "Kept for objects made before \"Scale factor of a copy\": when greater than 0, copies have this height, multiplied by the scale factor.", "group": "Model", "deprecated": true, "name": "Size" From 6b5f785c145978479069b1fd0153d7d6f3249d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Vivet?= Date: Tue, 10 Nov 2026 10:29:21 +0100 Subject: [PATCH 8/8] Describe the new anchor of scattered models in the changelog of Terrain3D --- extensions/reviewed/Terrain3D.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extensions/reviewed/Terrain3D.json b/extensions/reviewed/Terrain3D.json index 0757b6226..5cab7a036 100644 --- a/extensions/reviewed/Terrain3D.json +++ b/extensions/reviewed/Terrain3D.json @@ -46,6 +46,12 @@ "cave" ], "authorIds": [], + "changelog": [ + { + "version": "0.3.1", + "breaking": "- Scattered models now put the origin of their 3D model on the ground (\"Point put on the ground\" property), instead of the center of its base. Copies of models whose origin is elsewhere, like some trees of the asset store, can move a bit. Set \"Point put on the ground\" to \"Center of the model base\" to keep their previous placement." + } + ], "dependencies": [], "globalVariables": [], "sceneVariables": [],