3ds max 嵌套图层层次结构
3ds max nested layers hierarchy
如何使用 max 2015 sdk 枚举嵌套层的层次结构。
示例:我有 3 个图层,分别命名为“1”、“2”和“3”。
1 和 2 在根部,3 属于 1。
如何使用 sdk 查找此信息。
我可以找到一个节点所属的图层:
layer = (ILayer*)(node->GetReference(NODE_LAYER_REF));
在 ILayer 界面中,我找不到任何关于它的父级的信息。
我可以获得图层的一些 "extended" (?) 属性:
props = (ILayerProperties*)layer->GetInterface(LAYERPROPERTIES_INTERFACE);
我的问题也没有任何相关信息。
我可以访问图层管理器:
manager = (ILayerManager*) GetCOREInterface()->GetScenePointer()->GetReference(10);// don't remember where did I dig out the magic number 10
这里我可以按索引枚举所有层,但不能按层级枚举。
如有任何帮助,我们将不胜感激。谢谢
米兰
文档是这样说的:
Iterating over Layers by Index: The IFPLayerManager class is also an
interface class that manages scene layers in 3ds Max. This class
however is a function published interface, and thus is quite different
from the previously discussed layer manager. This class is the C++
interfaces to the MAXScript LayerManager class. This class has a
useful method fro returning a layer by integer index. Thus you can
iterate over scene layers without knowing the names of the layers. To
get a pointer to this object you call the GetCOREInterface() function.
IFPLayerManager* layer_manager = static_cast< IFPLayerManager*> GetCOREInterface( LAYERMANAGER_INTERFACE);
LAYERMANAGER_INTERFACE 标识 IFPLayerManager 接口。使用生成的指针,您可以通过整数索引获取场景图层。
ILayerProperties* hLayer = layer_manager->getLayer(i);
This IFPLayerManager::getLayer() method returns a ILayerProperties
pointer which has much less functionality than ILayer.
To get an ILayer pointer you can get a pointer to any object on that
layer, and extract the ILayer pointer from it.
ILayerProperties class 具有 child\parent 层的功能:
virtual ILayerProperties* getChildLayerProperties ( int n ) const
pure virtual
Remarks
Returns a pointer to the Nth child Layer properties for this layer.
Parameters:
int n
The index of the child layer properties.
Returns
Returns a pointer to the Nth child layer properties.
virtual ILayerProperties* getParentLayerProperties ( ) const
pure virtual
Remarks Returns the parent Layer. This could be NULL meaning the layer
is at the top level.
这意味着您可以通过索引遍历所有内容,然后检查它是否是父层,如果是则遍历所有子层,然后继续下一个。
这些函数记录在 3dsmax SDK 文档的 'ILayerProperties Class Reference' 中。
如何使用 max 2015 sdk 枚举嵌套层的层次结构。 示例:我有 3 个图层,分别命名为“1”、“2”和“3”。 1 和 2 在根部,3 属于 1。
如何使用 sdk 查找此信息。
我可以找到一个节点所属的图层:
layer = (ILayer*)(node->GetReference(NODE_LAYER_REF));
在 ILayer 界面中,我找不到任何关于它的父级的信息。 我可以获得图层的一些 "extended" (?) 属性:
props = (ILayerProperties*)layer->GetInterface(LAYERPROPERTIES_INTERFACE);
我的问题也没有任何相关信息。
我可以访问图层管理器:
manager = (ILayerManager*) GetCOREInterface()->GetScenePointer()->GetReference(10);// don't remember where did I dig out the magic number 10
这里我可以按索引枚举所有层,但不能按层级枚举。
如有任何帮助,我们将不胜感激。谢谢
米兰
文档是这样说的:
Iterating over Layers by Index: The IFPLayerManager class is also an interface class that manages scene layers in 3ds Max. This class however is a function published interface, and thus is quite different from the previously discussed layer manager. This class is the C++ interfaces to the MAXScript LayerManager class. This class has a useful method fro returning a layer by integer index. Thus you can iterate over scene layers without knowing the names of the layers. To get a pointer to this object you call the GetCOREInterface() function.
IFPLayerManager* layer_manager = static_cast< IFPLayerManager*> GetCOREInterface( LAYERMANAGER_INTERFACE);
LAYERMANAGER_INTERFACE 标识 IFPLayerManager 接口。使用生成的指针,您可以通过整数索引获取场景图层。
ILayerProperties* hLayer = layer_manager->getLayer(i);
This IFPLayerManager::getLayer() method returns a ILayerProperties pointer which has much less functionality than ILayer.
To get an ILayer pointer you can get a pointer to any object on that layer, and extract the ILayer pointer from it.
ILayerProperties class 具有 child\parent 层的功能:
virtual ILayerProperties* getChildLayerProperties ( int n ) const
pure virtual
Remarks Returns a pointer to the Nth child Layer properties for this layer. Parameters: int n
The index of the child layer properties. Returns Returns a pointer to the Nth child layer properties.
virtual ILayerProperties* getParentLayerProperties ( ) const
pure virtual
Remarks Returns the parent Layer. This could be NULL meaning the layer is at the top level.
这意味着您可以通过索引遍历所有内容,然后检查它是否是父层,如果是则遍历所有子层,然后继续下一个。
这些函数记录在 3dsmax SDK 文档的 'ILayerProperties Class Reference' 中。