Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
markeel committed May 4, 2023
1 parent 79851b0 commit 3baecf5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 34 deletions.
12 changes: 6 additions & 6 deletions addons/vizpath/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ platform.

To install it from the Godot Asset Library, select: TBD

There are 3 main directories
There are 3 main directories:
- addons/vizpath
- examples/vizpath
- source/vizpath

When loading as an asset in another project (as opposed to working on this asset) the following files
should NOT be imported, they will likely conflict with your project
should NOT be imported, they will likely conflict with your project:
- README.md
- LICENSE
- icon.svg
Expand Down Expand Up @@ -56,7 +56,7 @@ these errors a call to get_errors() can be made.

Based on the properties and how close the spots are allowed to be, you can guarantee that the path will
always be constructed. If you allow unrestrained movement of the spots and the normals, you will
need to report the error (which is what is done when using the Godot Editor)
need to report the error (which is what is done when using the Godot Editor).

### Directly in the editor

Expand All @@ -68,7 +68,7 @@ a subgizmo.

To use the subgizmo, click on the VisualizedPath and in the 3D view click on the yellow cone for
one of the spots. The manipulation gizmo changes to that spot and then it can be moved (changing
the position of the spot), or rotated (changing the normal at that spot)
the position of the spot), or rotated (changing the normal at that spot).

## Examples

Expand All @@ -77,5 +77,5 @@ delete this directory for your project.

## Source

Blender and Inkscape files used to create the meshes and the icon are included in the "source/vizpath"
directory, which can also be removed without impacting its usage.
The Blender and Inkscape files used to create the meshes and the icon are included in the "source/vizpath"
directory, which can also be removed without impacting this asset's use.
6 changes: 3 additions & 3 deletions addons/vizpath/resources/spot.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ extends Resource
class_name VisualizationSpot

## The VisualizationSpot class is a resource that allows the definition
## of a spot for a VisualizedPath
## of a spot for a VisualizedPath.
##
## A VisualizationSpot contains a point (local space) and a normal (local space)
## that identifies where the path starts, ends, or turns
## that identifies where the path starts, ends, or turns.

## The point in local space where the path originates, terminates, or turns at
## The point in local space where the path originates, terminates, or turns
@export var point : Vector3 :
set(p):
point = p
Expand Down
12 changes: 6 additions & 6 deletions addons/vizpath/resources/viz_head.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ class_name VizHead
# of a simple arrow head at the end of the path showing the
# final destination of the path.
#
# It is designed to be used interchangably with any resource
# that defineds an apply method with the signature defined
# It is designed to be used interchangeably with any resource
# that defines an apply method with the signature defined
# below.

## The width of the arrow head as a percentage of the
## path width it is associated with
## path width it is associated with.
@export var width_factor : float = 2.0 :
set(w):
width_factor = w
Expand All @@ -29,14 +29,14 @@ class_name VizHead
##
## This class can be overridden to provide a custom head to the path
## by defining a resource that has an apply method with the following
## definition.
## definition:
##
## The [code]mesh_node[/code] parameter is the mesh instance of the visualized path.
## Its interior mesh can be updated (typically with [SurfaceTool]).
## The [code]u[/code] parameter is the U texture coordinate of the [code]left[/code] and
## [code]right[/code] positions of the end of the path, where the V texture coordinate
## [code]right[/code] positions at the end of the path, where the V texture coordinate
## is 0.0 for [code]left[/code] and 1.0 for [code]right[/code]. The [code]normal[/code] and
## the [code]direction[/code] define the position of the face and the direction that
## the [code]direction[/code] define the position of the face and the direction that the
## path is going. The [code]path_mat[/code] is the material that was used
## in the original path definition [member VisualizedPath.path_mat].
func apply(mesh_node : MeshInstance3D, u : float, left : Vector3, right : Vector3, normal : Vector3, direction : Vector3, path_mat : Material):
Expand Down
14 changes: 11 additions & 3 deletions addons/vizpath/resources/viz_tail.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
extends Resource
class_name VizTail

# The VizTail class is a resource that allows the creation
# of a simple rounded tail at the beginning of the path showing the
# start of the path.
#
# It is designed to be used interchangeably with any resource
# that defines an apply method with the signature defined
# below.

## The number of segments in the semi-sphere of tail
@export var num_segs := 16 :
set(s):
Expand All @@ -13,14 +21,14 @@ class_name VizTail
##
## This class can be overridden to provide a custom tail to the path
## by defining a resource that has an apply method with the following
## definition.
## definition:
##
## The [code]mesh_node[/code] parameter is the mesh instance of the visualized path.
## Its interior mesh can be updated (typically with [SurfaceTool]).
## The [code]u[/code] parameter is the U texture coordinate of the [code]left[/code] and
## [code]right[/code] positions of the end of the path, where the V texture coordinate
## [code]right[/code] positions at the end of the path, where the V texture coordinate
## is 0.0 for [code]left[/code] and 1.0 for [code]right[/code]. The [code]normal[/code] and
## the [code]direction[/code] define the position of the face and the direction that
## the [code]direction[/code] define the position of the face and the direction that the
## path is going. The [code]path_mat[/code] is the material that was used
## in the original path definition [member VisualizedPath.path_mat].
func apply(mesh_node : MeshInstance3D, u : float, left : Vector3, right : Vector3, normal : Vector3, direction : Vector3, path_mat : Material):
Expand Down
32 changes: 16 additions & 16 deletions addons/vizpath/visualized_path.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## of spots which define the local object space positions and
## normals for the path at that point.
##
## The spots array can be defined programatically such as by
## The spots array can be defined programmatically such as by
## user action (such as clicking) or defined in the editor using
## the VizPath gizmo.
##
Expand Down Expand Up @@ -34,23 +34,23 @@ signal changed_layout
_rebuild()

## The path_width defines the width of the path, which indirectly
## determines how tight the path can turn at a midpoint spot
## determines how tight the path can turn at a midpoint spot.
@export_range(0.005, 100, 0.001) var path_width := 0.1 :
set(w):
path_width = w
_rebuild()

## The inner_curve_radius defines how tight a turn can be made
## at a midpoint spot within the path
## at a midpoint spot within the path.
@export_range(0.005, 100, 0.001) var inner_curve_radius := 0.1 :
set(r):
inner_curve_radius = r
_rebuild()

## The num_curve_segs defines how many points will be defined in the
## arc that are used to create a turn. More segments will make
## arc that are used to create a turn. More segments will
## make a smoother UV mapping and therefore the display of associated material
## more accurate
## more accurate.
@export_range(4, 128) var num_curve_segs := 32 :
set(r):
num_curve_segs = r
Expand All @@ -63,35 +63,35 @@ signal changed_layout
bend_segs = r
_rebuild()

## The bend_lip defines how long the bend in a path when transitioning between
## two spots with normals not in the same plane will be. Making this a smaller
## value will create a smaller bend
## The bend_lip defines the distance that a segment extends from the intersection
## of the planes defined by the beginning and ending normals when those normals
## are not in the same plane. Making this a smaller value will make the
## segment flatter for more of its length.
@export_range(0.005, 100, 0.001) var bend_lip := 0.1 :
set(r):
bend_lip = r
_rebuild()

## The bend_sharpness defines how sharp the bend in a path when transitioning
## between two spots with normals not in the same plane will be. Making this
## smaller will result in a tighter bend
## The bend_sharpness defines how sharp the bend in a path. Making this
## smaller will result in a tighter bend.
@export var bend_sharpness := 1.0 :
set(r):
bend_sharpness = r
_rebuild()

## The path_mat is the material that will be applied to the underlying mesh
## that displays the path. The initial spot in the path will have texture coordinates
## that start with U=0 and going to a value based on the actual length of the path.
## The V will range between 0 at the left side of the path, and 1 at the right side
## of the path (which is path_width) long.
## that start with U equal to 0.0 and ending at the value calculated as the actual length of the path
## in local space. The V will range between 0.0 at the left side of the path, and 1.0 at the
## right side of the path.
@export var path_mat : Material :
set(m):
path_mat = m
_rebuild()

## The path_head is a resource (optional) that defines the end of the path by
## providing an "apply" method. The provided [VizHead] resource is an example
## that draws an arrow head on the end
## that draws an arrow head on the end.
@export var path_head : VizHead :
set(m):
path_head = m
Expand All @@ -100,7 +100,7 @@ signal changed_layout

## The path_tail is a resource (optional) that defines the start of the path by
## providing an "apply" method. The provided [VizTail] resource is an example
## that draws an rounded cap on the end
## that draws a rounded cap on the end.
@export var path_tail : VizTail :
set(m):
path_tail = m
Expand Down

0 comments on commit 3baecf5

Please sign in to comment.