If Maya natively supports importing Chan files as cameras, then I didn't know that and you can ignore my suggestion ☺
That tool was written at a time when the desire was to be able to import Chan files produced by Nuke into multiple target applications like Maya, Flame/Inferno, and a couple other ones. On 9/09/2014 3:20 PM, "likage" <[email protected]> wrote: > Hmm.. I am not exactly looking for ways to convert the .chan again but > ways to import .chan into Maya. Initially I had thought this can be done > using the fileDialog2 command and importing in the animation while creating > a camera in maya itself. > > I will try and see if I can implement the code you have provided. > > Thank you! > > > On Monday, September 8, 2014 11:49:32 AM UTC+8, Justin Israel wrote: >> >> You are saying that your problem is not using the dialog and operating on >> the collected chan files, but rather the ability to translate the chan >> files into cameras? >> >> If you are specifically asking for a way to import chan files into Maya, >> I could reference a tool I had written for cmiVFX to do chan file >> conversions: https://github.com/justinfx/AtomSplitter >> You are welcome to cannibalize that. I wrote it over 4 years ago and its >> not my best work ever :-) But it does convert chan files to FBX which can >> be imported into Maya. >> >> I haven't been keeping up on whether there are better ways to do this >> currently. For all I know there is current support for .chan files or some >> hot new approach and I am just out of touch. >> >> >> >> >> >> >> On Mon, Sep 8, 2014 at 2:10 PM, likage <[email protected]> wrote: >> >>> Hi Marcus, you are right on the first point. >>> >>> Now what I am trying to achieve is to import in .chan (I'm trying to >>> rewrite the whole script) just by using maya.cmds and without the use of >>> maya api. I apologized if I have been going in rounds without making myself >>> clear, as I have been lost myself too. >>> >>> Thus right now I am trying to ditch this API coding since I am not >>> familiar with, and trying to do it using the maya.cmds method. So far, just >>> for the importing of this .chan file, I have met with errors which are >>> depicted in my previous posts - Unrecognized format etc. >>> >>> This is the coding that I have done so far: >>> multipleFilters = "chan (*.chan)" >>> fileList = cmds.fileDialog2(fileMode=1, fileFilter=multipleFilters, >>> dialogStyle=2) >>> >>> with open (fileList[0], 'rt') as filehandle: >>> for line in filehandle: >>> print line >>> >>> Results of the .chan information >>> 1 -1.95229 0.105858 4.26187 166.513 22.9641 -42.0018 >>> 26.9915 >>> >>> 2 -1.02854 0.509221 4.16079 -177.631 14.0901 -30.9537 >>> 26.9915 >>> >>> But as you can see, I am only printing or getting the camera >>> information, since it is only reading the file info and not creating any >>> node of the said file in the scene. >>> Thus, are there any ways that I can make it to create a camera node (as >>> .chan is a camera file) and ensure that it is reading the information >>> correctly? >>> >>> >>> >>> On Sunday, September 7, 2014 11:27:01 PM UTC+8, Marcus Ottosson wrote: >>>> >>>> likage, perhaps if you told us a little bit about what it is that you >>>> want to have happen when you run your code. Tell us about the expected >>>> results and what you expect to have happen. Are you looking to import a >>>> `.chan` file and have it applied onto a channel of a transform node? Are >>>> you looking to make it into a NURBS curve? >>>> >>>> At first, I thought your question was about intercepting the import >>>> command from the File menu, but that doesn't seem to be the case any more. >>>> Until I understand what you are looking for, it's quite difficult to point >>>> you in the right direction. >>>> >>>> On 7 September 2014 15:08, likage <[email protected]> wrote: >>>> >>>>> Pardon my noob-ness in this. >>>>> >>>>> Earlier I tried importing, specifically citing for a file format which >>>>> is *.chan* >>>>> Then as I implemented the bailed-out scenario and your code that you >>>>> have written, I got the same set of errors that I have posted previously >>>>> and I am not getting any statement etc. >>>>> >>>>> Still getting the unrecognized file error. >>>>> >>>>> >>>>> On Sunday, September 7, 2014 5:17:09 PM UTC+8, Justin Israel wrote: >>>>>> >>>>>> What I was saying was that if you are going to use the fileDialog >>>>>> approach, as you did, and you see that it returns an error, you would >>>>>> have >>>>>> to make sure that you take a look at the API documentation to confirm >>>>>> that >>>>>> you are using it properly. In this case, the fileDialog returns an array >>>>>> of >>>>>> strings, and you are passing that array to the file() command, which only >>>>>> takes a string. So you end up with an error. >>>>>> >>>>>> Because you are using a fileDialog command that allows the user to >>>>>> choose one existing file, you will need first check the filename variable >>>>>> to make sure it is set to something and that the user did not cancel the >>>>>> dialog. Because the people that designed the Maya cmds API love and value >>>>>> consistency, you will notice that if the dialog is canceled you get back >>>>>> a >>>>>> None instead of an empty list. Your check would be something like this: >>>>>> >>>>>> fileList = cmds.fileDialog2(fileMode=1, fileFilter=multipleFilters, >>>>>> dialogStyle=2)if not fileList: >>>>>> # return or print something or bail out early >>>>>> >>>>>> filename = fileList[0] >>>>>> cmds.file(filename, i=True) >>>>>> >>>>>> If you are allowing multiple files: >>>>>> >>>>>> fileList = cmds.fileDialog2(fileMode=4, fileFilter=multipleFilters, >>>>>> dialogStyle=2)if not fileList: >>>>>> # return or print something or bail out early >>>>>> for filename in fileList: >>>>>> cmds.file(filename, i=True) >>>>>> >>>>>> At this point, you have control over knowing which file is being >>>>>> imported and having the opportunity of doing pre/post >>>>>> >>>>>> >>>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Python Programming for Autodesk Maya" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit https://groups.google.com/d/ >>>>> msgid/python_inside_maya/9f367c51-cb0a-4a60-a341-b7addb27e3ae% >>>>> 40googlegroups.com >>>>> <https://groups.google.com/d/msgid/python_inside_maya/9f367c51-cb0a-4a60-a341-b7addb27e3ae%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> >>>> >>>> -- >>>> *Marcus Ottosson* >>>> [email protected] >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/python_inside_maya/c48e3724-528b-4027-922b- >>> 713dfbcae97d%40googlegroups.com >>> <https://groups.google.com/d/msgid/python_inside_maya/c48e3724-528b-4027-922b-713dfbcae97d%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/01c38f49-b0f8-416a-a71f-00d544d84c75%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/01c38f49-b0f8-416a-a71f-00d544d84c75%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0S34XUzFSXj5G4AQozXRXM41-0hqSj7AkPVbj0hneuyQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
