Notifications
Clear all

[Closed] SDK – Get INodeLayerProperties from INode

I’m trying to get the INodeLayerProperties interface from an INode. In the SDK help it says:

static_cast<INodeGIProperties*>(node->GetInterface(NODELAYERPROPERTIES_INTERFACE))

Now I notice that it casts to INodeGIProperties, which I assume is a typo and should be INodeLayerProperties. But even without the cast, the GetInterface returns a null pointer.

I found that I could get an ILayer from an INode using

ILayer* aLayer = (ILayer*) node->GetReference(NODE_LAYER_REF);

But this I’m not sure if or how I could get an INodeLayerProperties object from that…

The reason I’m looking for the INodeLayerProperties is that I want to use the ILayerProperties interface to get all nodes on a layer. And I’ve also noticed some strange behavior when undoing an ILayer.AddToLayer(node) operation, so I want to see if it might work better with an ILayerProperties.AddNode.

Thanks!

3 Replies

i try the following in my exporter, it worked (in that it showed up the correct name and color in the debugger) so probably is a misprint.

if(maxnode)
 	{
 		INodeLayerProperties* node_layer_props = static_cast<INodeLayerProperties*>(maxnode->GetInterface(NODELAYERPROPERTIES_INTERFACE));
 		if(node_layer_props)
 		{
 			ILayerProperties* layer_props = node_layer_props->getLayer();
 			if(layer_props)
 			{
 				MCHAR* lname = layer_props->getName();
 				Color c = layer_props->getWireColor();
 			}
 		}
 	}

maxnode is INode* type

Thanks for your reply.
The problem I’m having is that this seems to return a null-pointer for me:

maxnode->GetInterface(NODELAYERPROPERTIES_INTERFACE)

So that’s just getting the baseinterface; even before the cast.

are you certain maxnode is a valid INode* ?