Wiretap

Reply
Contributor
Posts: 14
Registered: ‎01-15-2003
Message 1 of 5 (197 Views)

beginner python question: WT #defines?

197 Views, 4 Replies
04-02-2007 08:47 PM
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?
Distinguished Contributor
Posts: 103
Registered: ‎05-11-2004
Message 2 of 5 (197 Views)

Re: beginner python question: WT #defines?

04-03-2007 08:28 PM 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
Contributor
Posts: 14
Registered: ‎01-15-2003
Message 3 of 5 (197 Views)

Re: beginner python question: WT #defines?

04-03-2007 10:40 PM 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.
Distinguished Contributor
Posts: 103
Registered: ‎05-11-2004
Message 4 of 5 (197 Views)

Re: beginner python question: WT #defines?

04-04-2007 05:18 AM 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.
Contributor
Posts: 14
Registered: ‎01-15-2003
Message 5 of 5 (197 Views)

Re: beginner python question: WT #defines?

04-04-2007 05:25 AM 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community