Guest User

Untitled

a guest
Jun 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. # turn off event generation - we don't want to spawn any triggers for these guys!
  2. tank.server.event_manager.EventManager().set_spawn_enabled(False)
  3.  
  4. # iterate over all assets
  5. for a in tank.server.Em().find("CharacterRig_v1").get_children():
  6. self.log_info("")
  7. self.log_info("Processing %s..." % a)
  8.  
  9.  
  10. # create new assets!
  11. ap = tank.server.AssetPublisher(tank.server.Em().find("CharacterRig_v2"), a.get_name())
  12. # and some default ones
  13. ap.set_property(_constants.STD_PROPERTY_DESCRIPTION, "Automatically migrated from %s" % a)
  14. ap.set_property(_constants.STD_PROPERTY_CREATED_BY, tank.util.misc.get_current_user())
  15. ap.set_property(_constants.STD_PROPERTY_EVENT_ID, None)
  16. # grab SG link from source asset
  17. ap.set_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK, a.get_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK).get_value())
  18. # copy additional properties across from old char rig
  19. ap.set_property(...)
  20. # set new label
  21. # all migrated assets have a medium property
  22. ap.set_property("resolution","medium")
  23. # and publish
  24. char_asset = ap.publish()
  25. self.log_notice("Created asset %s" % target_asset)
  26.  
  27. # create new assets!
  28. ap = tank.server.AssetPublisher(tank.server.Em().find("CharacterMocapData_v1"), a.get_name())
  29. # and some default ones
  30. ap.set_property(_constants.STD_PROPERTY_DESCRIPTION, "Automatically migrated from %s" % a)
  31. ap.set_property(_constants.STD_PROPERTY_CREATED_BY, tank.util.misc.get_current_user())
  32. ap.set_property(_constants.STD_PROPERTY_EVENT_ID, None)
  33. # grab SG link from source asset
  34. ap.set_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK, a.get_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK).get_value())
  35. # copy additional properties across from old char rig
  36. ap.set_property(...)
  37. # set new label
  38. # all migrated assets have a medium property
  39. ap.set_property("resolution","medium")
  40. # and publish
  41. mocap_asset = ap.publish()
  42. self.log_notice("Created asset %s" % target_asset)
  43.  
  44.  
  45.  
  46. # process revisions
  47. for r in a.get_revisions():
  48.  
  49. if r.get_entity_type().get_name() in ["dof", "mdl", ...]:
  50. tank.util.configuration.migrate_revision(r, mocap_asset)
  51. else:
  52. tank.util.configuration.migrate_revision(r, char_asset)
  53. # revision is not there!
  54.  
  55. self.log_notice("Migrated revision %s -> %s" % (r, target_asset))
Add Comment
Please, Sign In to add comment