Area :: Header
Interested in making Indie games?

Register for a Meet the Experts webinar with Digital-Tutors today!
Discussion Groups

Scripting

Reply
Contributor
chico
Posts: 11
Registered: ‎10-20-2006

Creating new UDA with python script

151 Views, 6 Replies
07-23-2011 03:45 PM
Hi!

I'm struggling to create new UDA with python script. I'm using autodesk_toxik.admin.setUDA method but always says that there's no such a component. I've tried to set the component path parameter to "Project:Title", "User:Administrator", simply "Composition", but none of them worked.
Could someone explain the concept of components in UDA's point of view, or could someone give me an example of component path, please.

Thank you.
Please use plain text.
Distinguished Contributor
morazz
Posts: 897
Registered: ‎04-04-2007

Re: Creating new UDA with python script

07-24-2011 11:04 AM in reply to: chico
Ok, here is what I think may be going on, bit of a long shot. Just as a side note, and I may not know what exactly you are doing, but you are wanting to set the UDA value of a existing UDA, is that correct? If you want to create a new one which you seem to have indicated you would want, which you can do this way, but is not as flexiable in my eyes as using the Class udaMGR and the method create(...). This is just a suggestion. Anyway, back to my hunch.
If you have any, (I am assuming you are under win7?) permission issues with how you have setup Composite, it will be hard to create new UDA within the system. I am not sure if this extends to Python, but I would think it would considering it is a OS issue. You need to check this out. One quick way is to see if you can just create a UDA within Composite itself, if you are having issues doing this, then you have this problem of permissions.
I have done a video on my blog on this issue, you can fine it here:
http://enigmafx.wordpress.com/2010/10/21/videotip8-permission-issue-and-my-fix/

If it is not this, I would have to look at this further.
Mark Rasmussen
VFX - Supervisor | Compositor
Enigma|FX

TOXIK/Composite BLOG
http://enigmafx.ca/efxblog
Please use plain text.
Contributor
chico
Posts: 11
Registered: ‎10-20-2006

Re: Creating new UDA with python script

07-25-2011 05:37 AM in reply to: chico
Thank you for permissions tip, Mark!

I tried to make new UDA manually, and this Composite hang, so I've gave up with it (now, after I've fixed permission it works ok).

I've started to implement new UDA with python. I want create two new UDAs - one containing date value, but in different format YYYY-MM-DD, instead of YY-MM-DD. I just don't know if it is possible to change date format in composite.
And another UDA should containing image import node's file sequence path. This is the main reason why I've started to to deal with python. I want to use import path in output node, to save output to the input path. In Nuke it is possible to enter expression into ouput path field to pick out import node's input path - something like
 ]/someDir/someName.tif
. I want to implement something similar in composite.

Concerning autodesk_toxik.admin.setUDA command - is not it a shortcut to udaMGR methods? udaMGR.setValue() method also requires path argument. My main concern by the moment is the path argument - what is this, where should I get it from?
Please use plain text.
Distinguished Contributor
morazz
Posts: 897
Registered: ‎04-04-2007

Re: Creating new UDA with python script

07-25-2011 11:36 AM in reply to: chico
I am not sure if you can change the date format either...

In regards to the import path, you can do this. You just get the string for the image import and then substitute the string on the output with the string from the imput and you should be good to go. Just remember you can also use tokens within the filePathPattern.

As far as the import path variable, I am not 100% up on this myself, but one thing you need to remember is that in Composite you are working in a pre-defined project and project path for example: x:/mark/project1 and within this you would have a structure that is designed to be accessed by you quickly and easily since it is all pre-defined, within the project. So a admin.getactualfilepath would be an example of this. I am not up on this as other are so perhaps someone else will chime in. I just do not have the time at the moment to work this out for you. I will say that you can do this. It is not just a mater of change or accessing the file path like in NUKE, it works on a different methodology. You are looking for a path of a composition, or a path of the project. I hope this makes sense.

cheers
Mark Rasmussen
VFX - Supervisor | Compositor
Enigma|FX

TOXIK/Composite BLOG
http://enigmafx.ca/efxblog
Please use plain text.
New Member
chico_1
Posts: 2
Registered: ‎01-24-2008

Re: Creating new UDA with python script

07-25-2011 12:38 PM in reply to: chico
Thank you for your thorough replies, Mark.

Could you please give me an example of using autodesk_toxik.admin.setUDA() or udaMGR.setValue() ? I just can't get it work. First argument in both commands is some PATH and I can't find the meaningful value for that.
my scripts and tips/tricks:
www.sergepogosyan.com
Please use plain text.
Contributor
chico
Posts: 11
Registered: ‎10-20-2006

Re: Creating new UDA with python script

09-30-2011 04:40 AM in reply to: chico
I've found the meaning of the PATH argument at last. It is simply full filesystem path of the Composition or Project. For example this:
admin.ProjectMgr.getCurrent().getPath()

works well for path argument of the admin.setUDA() method. But unfortunately new uda created by this way doesn't work. I've tryed this:

udaMgr = admin.UdaMgr()
udaMgr.create('new_uda')
udaMgr.setValue(admin.ProjectMgr.getCurrent().getPath(), 'new_uda', 'new_value')


new_uda does appear in the list of UDAs and can be inserted to render path but does not affect it in any way.

@Mark Rasmussen: Sorry for being impatient Mark, I was really in rush with this uda-script.
Please use plain text.
Distinguished Contributor
morazz
Posts: 897
Registered: ‎04-04-2007

Re: Creating new UDA with python script

09-30-2011 10:26 AM in reply to: chico
I am sorry I am not able to offer more help, this is an interesting issue and I would love to dive into it at this time, but I can't, I will do my best to offer tips that will direct you. Once I get some open time I will look into it. I have noted it. Remember I do not work for ADSK, so my time is limited. ;-)

Now you have used:
udaMgr.setValue(admin.ProjectMgr.getCurrent().getPath(), 'new_uda', 'new_value') as a way to set the value to the defined UDA with the project path.

As noted in the document, the only exception is if the UDA that is being assigned is not actually in the project. Just a thought, incase it is not creating it? Also, you have put the captured path value and put it as the first Parameter, and as documented this 'path' is not the path that you have captured. This would be assigned to 'value' parameter. The 'path' parameter, well I am not sure what it is referring to, I have not looked into this. UDA's are global, so why the specific path.. hmmm Had a little look at the XML tags for the UDA's and nothing relating to path. I wish I could help on this, just not sure what that parameter is referring to.... Try it with the 'path' parameter and see what happens?
Mark Rasmussen
VFX - Supervisor | Compositor
Enigma|FX

TOXIK/Composite BLOG
http://enigmafx.ca/efxblog
Please use plain text.