How to Debug a C++ Maya Plugin Using Visual Studio

Introduction

This post is not about creating a C++ Maya plugin, it is aimed at setting up debugging in Visual Studio for the plugin.

note: If you see the word “MayaMorph” in this post, it is because the project I am building is morphing between two geometric meshes. If you are interested there is more info on my website https://nickcullen.net.

Project Setup

We start off in Visual Studio. Open up your Maya plugin solution.

  • 1. Right click your plugins project properties

    Opening Visual Studio Project Properties Example
    Opening Visual Studio Project Properties Example
  • 2. Under Configuration Properties -> Debugging set the "Debugger to launch" option to "Local Windows Debugger".
Debugging Options Configuration Wiindow
Debugging Options Configuration Wiindow
  • 3. In the "Remote Command" entry, you want to put the full path (including extension) to the maya executable. For example my Maya is located at "C:\Program Files\Autodesk\Maya2016\bin\maya.exe" (Yours may be different!).

A handy trick to get the the full path to a file on your windows machine is to hold shift + right click on the executable, then click “Copy as Path“. You can simply paste the value into “Remote Command” removing any quotation marks.

  • 4. Set the "Attach" value to "Yes". This option attempts to attach the debugger to an already running Maya instance. Without this, it will launch Maya every time you launch the debugger.

Your values should look similar to these:

Values of set debugging properties
Values of set debugging properties

Your debugger is all set up.

If you haven’t done so yet, set some breakpoints and open Maya. Don’t run the debugger until Maya is fully open.

Debugging Maya Plugin

Once Maya is fully open, plugin compiled and loaded you can attach the debugger.

1. Click the "Local Windows Debugger" option at the top or simply hit F5
Selecting the debugger to run example
Selecting the debugger to run

Once you execute your plugin from within Maya, you should hit one of your break points like so.

Hitting a breakpoint example
Hitting a Breakpoint

Happy debugging!

Connect Raspberry Pi Via SSH

Introduction

One of the most fundamental methods with Raspberry Pi development is the ability to connect your Raspberry Pi via SSH to manipulate files and execute scripts which run on the Pi.
The following tutorial will apply for all platforms, however Windows does not have SSH built in by default. To allow SSH access to the Pi via windows, it is recommended to download a program called PuTTY.

With PuTTY, you can simply enter (and save) the IP Address of the pi, username and password (will get onto this in a moment) and click open.

PuTTY Configuration Window
PuTTY Configuration Window
For the purpose of this tutorial, I will use the ‘terminal’ way for connecting over SSH. Once you connect over SSH via PuTTY on Windows, you will be at the same point post-connection as you are connecting to the Pi via a Mac/Linux computer.

SSH Setup

Pi Requirements

To begin, you first need to enable SSH on the Pi itself. Unfortunately, this does require you to have a keyboard (+ mouse if you are not running a headless version of Raspbian) plugged into the Pi for the time being.

To enable SSH, we must use the raspi-config menu:

  1. Boot up the Pi
  2. Type “sudo raspi-config” at the terminal
  3. Navigate to “Advanced Options”
  4. Select “Enable SSH”
  5. Restart the Pi by selecting Finish

Important Note: If this is the first time you have booted up the Pi, before you restart the Pi (step 5), you must enable the device to auto log-on. Without this option enabled, your Pi will wait in a state where it is prompting you to enter the username and password for the user you want to log into. While the Pi is in this state, you will not be able to SSH into the Pi! See “Enable Boot to desktop” in the raspi-config manual

Connecting To the Raspberry Pi Via SSH

Now that SSH is enabled on our Pi, we can remove our keyboard and mouse which was previously connected to it and ensure the Pi is plugged into the same network as our main computer.

Default Settings

Unless you have changed them, the default settings for the Pi are as follows:

  • Username: “pi”
  • Password: “raspberry”

Opening the Connection [Mac & Linux]

Open up the terminal and enter the following command:

> ssh pi@192.168.1.5

A prompt will appear to enter the password of the user you wish to log in as. In this example, the user “Pi” is chosen.

Of course, don’t forget to change the IP address to match the address of your Pi.

Opening the Connection [Windows]

Simply open PuTTY, enter the IP address of the Pi, along with the username and password of the user you want to log in as (see default settings if you have not made any changes to the Pis user account) and click open.

Getting the IP Address of the Pi

In a future post I will describe how to set up a fixed IP address for your Pi. For now, your Pi will need to be plugged into a monitor. When you boot up your Pi, you should be able to see the following.

IP Address Shown on Boot Image
IP Address Shown on Boot

For those interested in understanding how SSH works and additional security measures to take, read Understanding SSH Keys