Skip to content

Commit 453d088

Browse files
authored
Expand Screenshotter plugin to generate documentation files and rename it to DocumentationToolkit (gaea-godot#563)
* Remplace Screenshotter by documentation toolkit * Add toast for capture all nodes * Fix lint issues * Updates for review * Add bbcode to markdown function
1 parent 52033d6 commit 453d088

File tree

16 files changed

+498
-206
lines changed

16 files changed

+498
-206
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mono_crash.*.json
1616

1717
addons/*
1818
!addons/gaea
19-
!addons/gaea_screenshotter
19+
!addons/gaea_documentation_toolkit
2020
!addons/gaea_gdUnit4
2121
scenes/test/*
2222

addons/gaea/graph/graph_nodes/node_resource.gd

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ enum SimSize
2828
WORLD
2929
}
3030

31+
enum DocumentationSection
32+
{
33+
TITLE,
34+
DESCRIPTION,
35+
ENUMS,
36+
ARGUMENTS,
37+
OUTPUTS,
38+
}
39+
40+
3141
#region Description Formatting
3242
const PARAM_TEXT_COLOR := Color("cdbff0")
3343
const PARAM_BG_COLOR := Color("bfbfbf1a")
@@ -164,11 +174,16 @@ func get_title() -> String:
164174
return _get_title()
165175

166176

167-
## Public version of [method get_description]. Prefer to override that method over this one.
177+
## Public version of [method _get_description]. Prefer to override that method over this one.
168178
func get_description() -> String:
169179
return _get_description()
170180

171181

182+
## Public version of [method _get_extra_documentation]. Prefer to override that method over this one.
183+
func get_extra_documentation(for_section: DocumentationSection) -> String:
184+
return _get_extra_documentation(for_section).strip_edges()
185+
186+
172187
func get_type() -> GaeaValue.Type:
173188
if not _get_output_ports_list().is_empty():
174189
return _get_output_port_type(_get_output_ports_list().back())
@@ -180,6 +195,16 @@ func get_enums_count() -> int:
180195
return _get_enums_count()
181196

182197

198+
## Public version of [method _get_enum_title]. Prefer to override that method over this one.
199+
func get_enum_title(enum_idx: int) -> String:
200+
return _get_enum_title(enum_idx)
201+
202+
203+
## Public version of [method _get_enum_description]. Prefer to override that method over this one.
204+
func get_enum_description(enum_idx: int) -> String:
205+
return _get_enum_description(enum_idx)
206+
207+
183208
## Public version of [_get_preview_simulation_size]. Prefer to override that method over this one.
184209
func get_preview_simulation_size() -> SimSize:
185210
return SimSize.PREVIEW
@@ -235,6 +260,11 @@ func get_argument_default_value(arg_name: StringName) -> Variant:
235260
return default_value_overrides.get(arg_name, _get_argument_default_value(arg_name))
236261

237262

263+
## Public version of [method _get_argument_description]. Prefer to override that method over this one.
264+
func get_argument_description(arg_name: StringName) -> String:
265+
return _get_argument_description(arg_name)
266+
267+
238268
## Public version of [method _get_argument_hint]. Prefer to override that method over this one.
239269
func get_argument_hint(arg_name: StringName) -> Dictionary[String, Variant]:
240270
return _get_argument_hint(arg_name)
@@ -255,6 +285,11 @@ func get_output_port_display_name(output_name: StringName) -> String:
255285
return _get_output_port_display_name(output_name)
256286

257287

288+
## Public version of [method _get_output_port_display_name]. Prefer to override that method over this one.
289+
func get_output_port_description(output_name: StringName) -> String:
290+
return _get_output_port_description(output_name)
291+
292+
258293
## Public version of [method _get_output_port_type]. Prefer to override that method over this one.
259294
func get_output_port_type(output_name: StringName) -> GaeaValue.Type:
260295
return _get_output_port_type(output_name)
@@ -289,8 +324,14 @@ func _get_title() -> String
289324

290325
## Override this method to define the description shown in the 'Create Node' dialog and in a
291326
## tooltip when hovering over this node in the graph editor.
292-
## Defining this method is [b]optional[/b], but recommended. If not defined, the description will be empty.
327+
## Defining this method is [b]optional[/b], but recommended.
293328
func _get_description() -> String:
329+
return "There is currently no description for this node."
330+
331+
332+
## Override this method to define extra text shown in the documentation.
333+
## Defining this method is [b]optional[/b].
334+
func _get_extra_documentation(_for_section: DocumentationSection) -> String:
294335
return ""
295336

296337

@@ -307,6 +348,19 @@ func _get_enums_count() -> int:
307348
return 0
308349

309350

351+
## Override this method if you want to change the display name for the enum in the documentation.[br][br]
352+
## Defining this method is [b]optional[/b].
353+
## If not defined, the name will be Enum # followed by the index + 1
354+
func _get_enum_title(enum_idx: int) -> String:
355+
return "Enum #%d" % (enum_idx + 1)
356+
357+
358+
## Override this method if you want to change the description for the enum in the documentation.[br][br]
359+
## Defining this method is [b]optional[/b].
360+
func _get_enum_description(enum_idx: int) -> String:
361+
return "There is currently no description for the enum #%d." % (enum_idx + 1)
362+
363+
310364
## Override this method to change what simulation size to use in previews. Returns a [SimSize].
311365
func _get_preview_simulation_size() -> SimSize:
312366
return SimSize.PREVIEW
@@ -367,6 +421,13 @@ func _get_argument_default_value(arg_name: StringName) -> Variant:
367421
return GaeaValue.get_default_value(_get_argument_type(arg_name))
368422

369423

424+
## Override this method to define the description of the arguments defined in [method _get_arguments_list].[br][br]
425+
## Defining this method is [b]optional[/b], but recommended.
426+
## If not defined, the argument will have no description.
427+
func _get_argument_description(arg_name: StringName) -> String:
428+
return "There is currently no description for the argument [code]%s[/code]." % arg_name
429+
430+
370431
## Override this method to change the way the editors for the arguments behave. For example,
371432
## if the returned [Dictionary] has a [code]"min"[/code] key, [GaeaNumberArgumentEditor] will not be able to go below that number.[br][br]
372433
## Defining this method is [b]optional[/b].
@@ -393,6 +454,12 @@ func _get_output_port_display_name(output_name: StringName) -> String:
393454
return output_name.capitalize()
394455

395456

457+
## Override this method to define the description for any outputs in [method _get_output_ports_list].[br][br]
458+
## Defining this method is [b]optional[/b].
459+
func _get_output_port_description(output_name: StringName) -> String:
460+
return "There is currently no description for output [code]%s[/code]." % output_name
461+
462+
396463
## Override this method to define the type of the outputs defined in [method _get_output_ports_list].[br][br]
397464
## Defining this method is [b]required[/b].
398465
@abstract

addons/gaea/resources/gaea_value.gd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ static func has_preview(type: Type) -> bool:
6262
return type == Type.MAP or type == Type.SAMPLE
6363

6464

65+
## Return the name of the [param type].
66+
static func get_type_string(type: Type) -> String:
67+
if type < TYPE_MAX:
68+
return type_string(type)
69+
return String(Type.find_key(type)).capitalize().replace(" ", "")
70+
71+
6572
## Returns the configured color for slots of [param type].
6673
static func get_color(type: Type) -> Color:
6774
if GaeaEditorSettings.CONFIGURABLE_SLOT_COLORS.has(type):

0 commit comments

Comments
 (0)