AREA forums upgrade
Read more about the planned upgrade of our forums
  • 1/3
You are here: Forum Home / Autodesk Composite, Toxik and Combustion / Scripting / Creating new UDA with python script
IMPORTANT ANNOUNCEMENT ABOUT AREA FORUMS
  RSS 2.0 ATOM  

Creating new UDA with python script
Rate this thread
 
58327
 
Permlink of this thread  
avatar
  • sergo
  • Posted: 23 July 2011 11:45 AM
  • Total Posts: 11
  • Joined: 15 December 2006 12:51 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.



http://www.sergepogosyan.com

Replies: 1
/userdata/avatar/avatar_99355.jpg

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.

Author: Mark R.

Replied: 24 July 2011 07:04 AM  
avatar
  • sergo
  • Posted: 25 July 2011 01:37 AM

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

[file dirname [knob Read1.file]]/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?



http://www.sergepogosyan.com

Replies: 0
avatar
  • Mark R.
  • Posted: 25 July 2011 07:36 AM

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/blog

Replies: 0
avatar
  • chico
  • Posted: 25 July 2011 08:38 AM

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:
http://www.sergepogosyan.com

Replies: 0
avatar
  • sergo
  • Posted: 30 September 2011 12:40 AM

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.



http://www.sergepogosyan.com

Replies: 1
/userdata/avatar/avatar_99355.jpg

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?

Author: Mark R.

Replied: 30 September 2011 06:26 AM