PDA

View Full Version : SDK - Get INodeLayerProperties from INode


Pjanssen
03-11-2012, 10:59 AM
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!

Klunk
03-15-2012, 10:38 PM
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

Pjanssen
03-16-2012, 09:19 PM
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.

Klunk
03-21-2012, 08:40 PM
are you certain maxnode is a valid INode* ?

CGTalk Moderation
03-21-2012, 08:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.