shortcut for creating new resource

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cgvirus

Is there any way to add a shortcut to create new resource in file system?

Reason is: it would save lots of click and navigation as create new resource is one of the most used command in my workflow.

I don’t think there is, but you can suggest it in the suggestions github GitHub - godotengine/godot-proposals: Godot Improvement Proposals (GIPs)

exuin | 2022-05-23 16:29

:bust_in_silhouette: Reply From: CharlesMerriam

I use an external shell script, because it gets slightly involved. A key item to remember is Godot will watch the filesystem and update itself.

A typical component Widget for me will start with the same sample, copy the script, and then also copy a WidgetHarness with script to test it. That said, here’s my script for use in MacOS…

#/bin/zsh
PROJECT=$1
COMPONENT=$2
GODOT="/Users/charlesmerriam/p/godot"
echo "In Project" $PROJECT
echo "   Add Component $COMPONENT"
read -n 1 -p 'Press any key if this looks good.'
DEST=$GODOT/$PROJECT/Components/$COMPONENT
echo "\nCreate the $DEST directory"
mkdir $DEST
read -n 1 -p 'Press any key to continue...'
echo "\nCopy basic files from BLANK's Hello compoenent"
cp $GODOT/Blank/Components/Hello/Hello.gd $DEST/$COMPONENT.gd
cp $GODOT/Blank/Components/Hello/Hello.tscn $DEST/$COMPONENT.tscn
cp $GODOT/Blank/Components/Hello/HelloHarness.gd $DEST/${COMPONENT}Harness.gd
cp $GODOT/Blank/Components/Hello/HelloHarness.tscn $DEST/${COMPONENT}Harness.tscn
ls -l $DEST
read -n 1 -p 'Press any key to continue...'
echo "\nFix references to new name"
sed -i '' "s/Hello/$COMPONENT/g" $DEST/*