Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # turn off event generation - we don't want to spawn any triggers for these guys!
- tank.server.event_manager.EventManager().set_spawn_enabled(False)
- # iterate over all assets
- for a in tank.server.Em().find("CharacterRig_v1").get_children():
- self.log_info("")
- self.log_info("Processing %s..." % a)
- # create new assets!
- ap = tank.server.AssetPublisher(tank.server.Em().find("CharacterRig_v2"), a.get_name())
- # and some default ones
- ap.set_property(_constants.STD_PROPERTY_DESCRIPTION, "Automatically migrated from %s" % a)
- ap.set_property(_constants.STD_PROPERTY_CREATED_BY, tank.util.misc.get_current_user())
- ap.set_property(_constants.STD_PROPERTY_EVENT_ID, None)
- # grab SG link from source asset
- ap.set_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK, a.get_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK).get_value())
- # copy additional properties across from old char rig
- ap.set_property(...)
- # set new label
- # all migrated assets have a medium property
- ap.set_property("resolution","medium")
- # and publish
- char_asset = ap.publish()
- self.log_notice("Created asset %s" % target_asset)
- # create new assets!
- ap = tank.server.AssetPublisher(tank.server.Em().find("CharacterMocapData_v1"), a.get_name())
- # and some default ones
- ap.set_property(_constants.STD_PROPERTY_DESCRIPTION, "Automatically migrated from %s" % a)
- ap.set_property(_constants.STD_PROPERTY_CREATED_BY, tank.util.misc.get_current_user())
- ap.set_property(_constants.STD_PROPERTY_EVENT_ID, None)
- # grab SG link from source asset
- ap.set_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK, a.get_property(_constants.STD_PROPERTY_ASSET_SHOTGUN_LINK).get_value())
- # copy additional properties across from old char rig
- ap.set_property(...)
- # set new label
- # all migrated assets have a medium property
- ap.set_property("resolution","medium")
- # and publish
- mocap_asset = ap.publish()
- self.log_notice("Created asset %s" % target_asset)
- # process revisions
- for r in a.get_revisions():
- if r.get_entity_type().get_name() in ["dof", "mdl", ...]:
- tank.util.configuration.migrate_revision(r, mocap_asset)
- else:
- tank.util.configuration.migrate_revision(r, char_asset)
- # revision is not there!
- self.log_notice("Migrated revision %s -> %s" % (r, target_asset))
Add Comment
Please, Sign In to add comment