Wiretap (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

beginner python question: WT #defines?

4 REPLIES 4
Reply
Message 1 of 5
panisset
500 Views, 4 Replies

beginner python question: WT #defines?

I have a beginner Python question: let's say I'm traversing the hierarchy, I've got a node object and I want to figure out its type:

typeInt = WireTapInt()
node.getNodeType( typeInt )
if typeInt == IFFFS_WT_TYPE_CLIP:
do something

But IFFFS_WT_TYPE_CLIP is an anonymous enum from ifffsWTTypes.h, how to I access that in Python code? I'd rather avoid hardcoding "6" instead of IFFFS_WT_TYPE_CLIP, and calling:

name = wireTapStr()
parent.getNode( name )
if name == "CLIP":
do something

doesn't seem much better. It looks like you are using boost.python to export the C++ API to Python, and from the brief Googling I've done, it is possible to export C++ enums that way, but I can't find any info on how to access these enum values?
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: panisset

Hi J-F,

We are deprecating the use of integer/enum node types (for this very reason), in favour of string representations. We want to avoid having to include a header for a given server, as well as make the code a bit easier to read.

The API calls you are using will remain for a few versions, and will then be removed.

Dan
Message 3 of 5
panisset
in reply to: panisset

It would be great if the Python DSO would export string variables containing those strings, so that I can reference a variable name instead of hard-coding a string in my Python code. That gives me a bit of "compile-time" checking, as opposed to failing at runtime because I made a typo in a string being passed to the API.
Message 4 of 5
Anonymous
in reply to: panisset

Right.

Part of the reason we don;t have these is because the API you have is essentially generic (i.e. no IFFFS-isms). IFFFS is not the only product to be exposed by WT. To do what you are asking, we would need a companion DSO from each of the WT-capable products.
Message 5 of 5
panisset
in reply to: panisset

That sounds like a reasonable approach: just provide a helper DSO for different applications which you can link again/dlopen() if you want the additional convenience/safety of not hard-coding these strings in your app.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report