Using new PointerProperty with custom property I'm working on development of the appleseed plugin and I'm trying to wrap my head around using the new ability of the Pointer Property to be used with the custom properties we add with that exporter.

Specifically we use the node system with our materials.  Right now a material references it's node tree via a bpy.props.StringProperty.  While this works it has serious shortcomings for linking and appending.  From what I understand we should now be able to have a pointer property in that node tree reference that connects the actual node_group datablock to that property.  I'm still a bit green on Blender's Python API so I'm not sure how to set that up.
This is how I do it in the Blender addon for LuxCore:

import bpy
from bpy.props import PointerProperty

def init():
    bpy.types.Material.luxcore = PointerProperty(type=LuxCoreMaterialProps)

class LuxCoreMaterialProps(bpy.types.PropertyGroup):
    node_tree = PointerProperty(name="Node Tree", type=bpy.types.NodeTree)


(The init() function is called in the top-level register() function)
You can then access the node tree like this (example from the Python console):

&gt;&gt;&gt; material = bpy.data.materials['Material']
&gt;&gt;&gt; material.luxcore.node_tree
bpy.data.node_groups['Material']


I think it's a good idea to add all properties specific to an external renderer to a PropertyGroup like "luxcore" or "appleseed" to prevent any conflicts. Cycles does the same thing.

Important

Note that PointerProperties attached to the material are not properly loaded in versions prior to 2.79a RC1: https://developer.blender.org/T53509

See also my notes on PointerProperties in the blenderseed bug tracker for issues with backwards/forwards compatibility: https://github.com/appleseedhq/blenderseed/issues/31