Jump to content

Recommended Posts

  • 2 years later...

I think I've got this working.  each tile index has it's own mantra rop so they are separate processes on our farm.

 

1. Generate ifds

2. Change mantra command parm to say "mantra -P '[path to script] --index 0 --xtiles 4 --ytiles 2' " on every rop, changing the index number appropriately.

 

 

here's the script

import sys, mantra,re, math, optparse

def filterCamera():
  #arguements
  parser = optparse.OptionParser()
  parser.add_option("-i", "--index", help="tile index")
  parser.add_option("-x", "--xtiles", help="number of x tiles")
  parser.add_option("-y", "--ytiles", help="number of y tiles")
  (options, args) = parser.parse_args()
  tile_count_x=int(options.xtiles)
  tile_count_y=int(options.ytiles)
  tileindex = int(options.index)
  print "filtering ifd"
  #update tile index-----------------------------------------------------------------
  res =mantra.property('image:resolution')

  if tile_count_x * tile_count_y > 1:
    tile_res_x= res[0]/tile_count_x
    tile_res_y= res[1]/tile_count_y
    tile_idx_y = int(tileindex/tile_count_x)
    tile_idx_x =  int(tileindex%tile_count_x)
    pc = [
	math.ceil(tile_idx_x * tile_res_x),
	min(math.ceil((tile_idx_x+1.0) * tile_res_x) - 1, res[0]-1),
	math.ceil(tile_idx_y * tile_res_y),
	min(math.ceil((tile_idx_y+1.0) * tile_res_y) - 1, res[1]-1)  ]
    mantra.setproperty('image:pixelcrop', pc)

    #updatefilename--------------------------------------------------------------------
    rendername = mantra.property('image:filename')
    nrn = re.split("_tile\d{2}_", rendername[0])
    filename = nrn[0]+"_tile"+str(tileindex).zfill(2)+"_"+nrn[1]
    mantra.setproperty('image:filename', filename)



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...