forked from TokisanGames/Terrain3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTerrain3DInstancer.xml
145 lines (145 loc) · 7.81 KB
/
Terrain3DInstancer.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Terrain3DInstancer" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
<brief_description>
</brief_description>
<description>
This class places mesh instances defined in the Terrain3D asset dock into MultiMeshInstance3Ds on the ground.
Data is currently stored in [member Terrain3DRegion.instances] and loaded into MultiMeshInstances, which are attached to the scene tree and managed by this class.
[b]The methods available for adding instances are:[/b]
- [method add_transforms] - Accepts your list of transforms and parses them by region and cell location and stores in our data storage. Recommended for general API instancing.
- [method add_multimesh] - Pulls the transforms out of your MultiMesh and calls add_transforms.
- [method add_instances] - A feature rich function designed for hand editing via Terrain3DEditor.
- Creating your own instance data and inserting it directly into [member Terrain3DRegion.instances]. It's not difficult to do this in GDScript, but a thorough understanding of the C++ code in this class is recommended.
[b]The methods available for removing instances are:[/b]
- [method remove_instances] - Like add_instances, this is can be used procedurally but is designed for hand editing.
- [method clear_by_mesh], [method clear_by_location] - To erase large sections of instances
- Editing [member Terrain3DRegion.instances] directly.
After modifying region data, run [method force_update_mmis] to rebuild the MultiMeshInstance3Ds.
[b]Read More:[/b]
- [b]Tutorial:[/b] [url=https://terrain3d.readthedocs.io/en/stable/docs/instancer.html]Foliage Instancing[/url]
- [b]Godot Reference:[/b] [url=https://docs.godotengine.org/en/stable/classes/class_multimesh.html]MultiMesh[/url]
</description>
<tutorials>
</tutorials>
<methods>
<method name="add_instances">
<return type="void" />
<param index="0" name="global_position" type="Vector3" />
<param index="1" name="params" type="Dictionary" />
<description>
Used by Terrain3DEditor to place instances given many brush parameters. In addition to the brush position, it also uses the following parameters: asset_id, size, strength, fixed_scale, random_scale, fixed_spin, random_spin, fixed_tilt, random_tilt, align_to_normal, height_offset, random_height, vertex_color, random_hue, random_darken. All of these settings are set in the editor through tool_settings.gd.
</description>
</method>
<method name="add_multimesh">
<return type="void" />
<param index="0" name="mesh_id" type="int" />
<param index="1" name="multimesh" type="MultiMesh" />
<param index="2" name="transform" type="Transform3D" default="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)" />
<param index="3" name="update" type="bool" default="true" />
<description>
Allows procedural placement of meshes, or importing from another MultiMeshInstancer placement tool. The specified mesh_id should already be setup as a [Terrain3DMeshAsset] in the asset dock. This function extracts the instance transforms and colors from a multimesh and passes it to [method add_transforms].
Update will regenerate the MultiMeshInstances. Disable for bulk adding, then call at the end.
</description>
</method>
<method name="add_transforms">
<return type="void" />
<param index="0" name="mesh_id" type="int" />
<param index="1" name="transforms" type="Transform3D[]" />
<param index="2" name="colors" type="PackedColorArray" default="PackedColorArray()" />
<param index="3" name="update" type="bool" default="true" />
<description>
Allows procedural placement of meshes. The mesh_id should already be setup as a [Terrain3DMeshAsset] in the asset dock. You provide the array of Transform3Ds and optional Colors, which will be parsed into our data storage.
This function adds the [member Terrain3DMeshAsset.height_offset] to the transform along its local Y axis.
Update will regenerate the MultiMeshInstances. Disable for bulk adding, then call at the end.
</description>
</method>
<method name="append_location">
<return type="void" />
<param index="0" name="region_location" type="Vector2i" />
<param index="1" name="mesh_id" type="int" />
<param index="2" name="transforms" type="Transform3D[]" />
<param index="3" name="colors" type="PackedColorArray" />
<param index="4" name="update" type="bool" default="true" />
<description>
Appends new transforms to the existing data within a region location. The mesh_id should already be setup as a [Terrain3DMeshAsset] in the asset dock.
Update will regenerate the MultiMeshInstances. Disable for bulk adding, then call at the end.
</description>
</method>
<method name="append_region">
<return type="void" />
<param index="0" name="region" type="Terrain3DRegion" />
<param index="1" name="mesh_id" type="int" />
<param index="2" name="transforms" type="Transform3D[]" />
<param index="3" name="colors" type="PackedColorArray" />
<param index="4" name="update" type="bool" default="true" />
<description>
Appends new transforms to the existing data within a region location. The mesh_id should already be setup as a [Terrain3DMeshAsset] in the asset dock.
Update will regenerate the MultiMeshInstances. Disable for bulk adding, then call at the end.
</description>
</method>
<method name="clear_by_location">
<return type="void" />
<param index="0" name="region_location" type="Vector2i" />
<param index="1" name="mesh_id" type="int" />
<description>
Removes all instancer data and MultiMeshInstance nodes attached to the tree for the specified region location and mesh id.
</description>
</method>
<method name="clear_by_mesh">
<return type="void" />
<param index="0" name="mesh_id" type="int" />
<description>
Removes all instancer data and MultiMeshInstance nodes attached to the tree for all regions for the specified mesh id.
</description>
</method>
<method name="clear_by_region">
<return type="void" />
<param index="0" name="region" type="Terrain3DRegion" />
<param index="1" name="mesh_id" type="int" />
<description>
Removes all instancer data and MultiMeshInstance nodes attached to the tree for the specified region and mesh id.
</description>
</method>
<method name="dump_data">
<return type="void" />
<description>
Dumps the instancer data arrays and dictionaries for all regions.
</description>
</method>
<method name="dump_mmis">
<return type="void" />
<description>
Dumps the MultiMeshInstance3Ds attached to the tree and information about the nodes for all regions.
</description>
</method>
<method name="force_update_mmis">
<return type="void" />
<description>
Removes and rebuilds all MultiMeshInstance3Ds attached to the tree.
</description>
</method>
<method name="remove_instances">
<return type="void" />
<param index="0" name="global_position" type="Vector3" />
<param index="1" name="params" type="Dictionary" />
<description>
Uses parameters asset_id, size, strength, fixed_scale, random_scale, slope (Vector2), to randomly remove instances within the indicated brush position and size.
</description>
</method>
<method name="swap_ids">
<return type="void" />
<param index="0" name="src_id" type="int" />
<param index="1" name="dest_id" type="int" />
<description>
Swaps the ID of two meshes without changing the mesh instances on the ground.
</description>
</method>
<method name="update_transforms">
<return type="void" />
<param index="0" name="aabb" type="AABB" />
<description>
Reviews all existing instance transforms within an AABB and adjusts their heights to match the terrain.
</description>
</method>
</methods>
</class>