Adding a Tool

Hey all,

Due to "popular" demand, I'm trying to create a Processing Tool. I've followed the guide here, and I have the correct directory structure (top-level directory with the name of the class that implements Tool, tool.properties, a tool directory containing my jar, and a src directory), now I just need to know where to put that directory.

I've tried putting it in the tools directory in the Processing documents folder (the default place where Processing wants to save sketches), as well as in the tools directory of the Processing directory itself (where Processing.exe itself is located). Neither one adds the tool to the tools menu. I've also tried putting the .zip of my tool directory in both places, still no result.

Am I missing a step?

Answers

  • Answer ✓

    tools directory in the Processing documents folder (the default place where Processing wants to save sketches)

    Is the correct location. I suggest that you launch Processing and add some tools, then you can use Windows Explorer / Finder to view the tools folder and see how they are structured. One important thing is that the name of the user tool folder and the tool jar filename are identical otherwise it will be invisible to Processing.

    Are you using Eclipse to create the tool. This is the best way.

    (1) Follow the instructions here (Option B is easier) and setup a blank Eclipse Project

    (2) In the build.properties file (section 2) change the file location so that it points to a folder with the core.jar and pde.jar files.

    (3) In the build.properties file (section 4) change the project.name= ???? to the name of your tool (first letter should be uppercase.

    (4) In the source folder there will be a single java file open it in the editor. Right click on the class name and select Refactor | Rename and rename the class to be the same as project.name

    (5) In Eclipse select Window | Show View | Ant and a new view (Ant) will appear in the top right pane.

    (6) In Eclipse, Package Explorer pane open the resource folder and drag the build.xml file to the Ant view pane.

    (7) Double click on this file in the Ant view to build the tool.

    If all went well the tool will build successfully and it will put the tool in the correct folder for Processing. Simply launch Processing and select the new tool from the menu.

    The advantage of doing it this way is that your tool will be packaged in a way that it can easily be distributed and installed through Processing's Add Tool menu option.

  • edited March 2014

    You were right, renaming the jar to the same name as the tool directory (which is the same name as the class that implements Tool) did the trick.

    This means that the documentation is wrong, as it says:

    The name of the outermost folder must conform to the name of the class implementing the Tool interface. The name of the JAR contained in /tool/ does not matter.

    Either way, it's working now, so thanks a lot!

    Btw I am using eclipse, but I'm converting an existing project, so I'm mostly starting from scratch. But everything seems to be working great now!

    Edit- I just went in and fixed the documentation. Hooray open source!

Sign In or Register to comment.