Skip to content

Commit f0540af

Browse files
Grey out the context menu item if no urdf is selected (#18)
1 parent d987071 commit f0540af

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Editor/MenuItems/UrdfImporterContextMenuItem.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
namespace RosSharp.Urdf.Editor
88
{
99
public static class UrdfImporterContextMenuItem
10-
{
10+
{
11+
[MenuItem("Assets/Import Robot from URDF", true, 0)]
12+
public static bool CreateUrdfObject_IsValid()
13+
{
14+
string assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);
15+
16+
return (Path.GetExtension(assetPath)?.ToLower() == ".urdf");
17+
}
18+
1119
[MenuItem("Assets/Import Robot from URDF")]
1220
private static void CreateUrdfObject()
1321
{

0 commit comments

Comments
 (0)