Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can any one explain why my script does not work on Matchmover?

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
317 Views, 0 Replies

Can any one explain why my script does not work on Matchmover?

Hi there, I have modified an old perl script to export 2d tracks to max(used t work back in 2007) but it does not seem to work now. Can anyone help me to find what am i missing. script as follows.

######################################################################
#
#
#3ds max 2D track extractor v0.01 SAVAŞ ÇETİN
#Base code:MatchMover Perl Sample Scripts: NUKE Export (c) REALViZ 2004-2005
#
#
#
#######################################################################

# parameters
#my $output_file = "c:/test.nk"; # exported file
my $output_file = $mm->showMessage( "This Perl script will export tracks of the current seqence to the program root directory as a maxscript file (*.ms):", -1 );
die "no output file" if ( !defined $output_file );

# helper to convert whitespaces to underscore
sub conformString
{
my $string = shift;
$string =~ s/ /_/g;
return $string;
}

# open output file
open( OUTPUT, ">", $output_file ) || die "couldn't open the file $output_file !";

## header data
print OUTPUT "-- REALViZ MatchMover Pro 3ds Max 2D track exporter output file by SAVAS CETİN \n";
print OUTPUT "-- version 0.01 \n";
#print OUTPUT "version 4.3020\n";

#
# get sequence/cameras settings
#
my &#xse;quenceAttribs = %{$mm->getSequenceAttribs( $mm->getSequenceId() )}; # attributes of current sequence
my $sequenceLabel = conformString( $sequenceAttribs{label} ); # sequence label
my $firstFrame = $sequenceAttribs{first}; # first frame
my $lastFrame = $sequenceAttribs{last}; # last frame
my ÊmeraAttribs = %{$mm->getCameraAttribs( $sequenceAttribs{camera} )}; # corresponding camera attributes
my $haperture = $cameraAttribs{fbw}; # film back width
my $vaperture = $cameraAttribs{fbh}; # film back height
my $numframes = $lastFrame - $firstFrame + 1; # nb of frames
my $height = $cameraAttribs{h}; # image height
my $input = $sequenceAttribs{file}; # input sequence filename
my $imagePlaneDepth = 100.0; # depth of image plane
my $label = conformString( $trackAttribs{label} );
# replace # and @ in input sequence name by corresponding printf pattern ( file.###.jpg ==> file. d.jpg )
my $hashcount = () = $input =~ /#/g;
$input =~ s/(#)+/%0${hashcount}d/g;
$input =~ s/@/%d/g;

# feedback to user
print "Exporting sequence '$sequenceLabel' to file '$output_file'...";

print OUTPUT " animationRange = interval $firstFrame"; print OUTPUT "f\t"; print OUTPUT "$lastFrame"; print OUTPUT "f \n";

#print OUTPUT "}\n";

#======================
# export all 2D tracks
#======================

# for all groups
my @groups = ( -1, @{$mm->getGroupList()} ); # add default group
foreach $group ( @groups ) # browse all groups
{
my $glabel;
if ( $group == -1 ) { # defaul group
$glabel = "Point_Tracks";

} else {
# collect info of this group
my &#xgr;oupAttribs = %{$mm->getGroupAttribs( $group )};
$glabel = conformString( $groupAttribs{label} );

}

my @tracks = @{$mm->getTrackList( $group )}; # collect all tracks of this group

# exports all tracks of the group
foreach $track ( 0..$#tracks )
{


my @track2Dinfos = @{$mm->getTrack2D( $tracks )}; # get track 2D positions
my &#xtr;ackAttribs = %{$mm->getTrackAttribs( $tracks )}; # get track attributes
$label = conformString( $trackAttribs{label} );
print OUTPUT "$label = Dummy name:\"$label\" boxsize: \n"; # set Dummy name and size
print OUTPUT "animate on ( ";
print OUTPUT "\n";
foreach $t2Dinfo ( @track2Dinfos )
{
my &#xha;sh = %{ $t2Dinfo };
my $t = $hash{t} + $firstFrame;
my $y = $height - $hash{y} ;
my $u = $y / 10; # scale values
my $w = $hash{x} /10; #scale values
print OUTPUT "at time $hash{t}f $label.position = \n" ; #scaled values
#print OUTPUT "at time $hash{t}f $label.position = \n" ; #original values
##print OUTPUT "x$t $y \n"; ##
##print OUTPUT "x$t $hash{x} \n"; ##
}
print OUTPUT ") \n";




}


}




# close output file
close( OUTPUT );

thank you.
0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report