Example #1
0
  /** @return The path of a node */
  private Path getNodePath(String nodeName) throws PipelineException {

    NodeID targetID = new NodeID(w.user, w.view, nodeName);
    NodeStatus targetStat = mclient.status(targetID);
    NodeMod targetMod = targetStat.getHeavyDetails().getWorkingVersion();
    if (targetMod == null)
      throw new PipelineException(
          "No working version of the Target Scene Node ("
              + nodeName
              + ") exists "
              + "in the ("
              + w.view
              + ") working area owned by ("
              + PackageInfo.sUser
              + ")!");

    Path targetPath;

    FileSeq fseq = targetMod.getPrimarySequence();
    String suffix = fseq.getFilePattern().getSuffix();
    if (!fseq.isSingle() || (suffix == null) || (!suffix.equals("ma") && !suffix.equals("mb")))
      throw new PipelineException("The target node (" + nodeName + ") must be a maya scene!");
    targetPath =
        new Path(PackageInfo.sProdPath, targetID.getWorkingParent() + "/" + fseq.getFile(0));

    // System.err.println("$WORKING"+nodeName+"."+suffix);
    return targetPath;
  } // end getNodePath(String)
Example #2
0
  /**
   * Using a list of shots and the assets to be changed per shot, gets each shot node and modifies
   * the references as needed.
   */
  private void processNodes() throws PipelineException {
    /*each asset, its replacement and the lo-res versions*/
    for (String asset : pAssetManager.keySet()) {
      String newAsset = pAssetManager.get(asset).getNewAsset();
      String hrAsset = asset.replace(lr, "");
      String newHrAsset = newAsset.replace(lr, "");
      logLine(
          "Checking out nodes:\n\t"
              + asset
              + "\n\t"
              + hrAsset
              + "\n\t"
              + newAsset
              + "\n\t"
              + newHrAsset);

      mclient.checkOut(w.user, w.view, asset, null, over, froz);
      mclient.checkOut(w.user, w.view, newAsset, null, over, froz);
      mclient.checkOut(w.user, w.view, hrAsset, null, over, froz);
      mclient.checkOut(w.user, w.view, newHrAsset, null, over, froz);
    } // end for

    TreeMap<String, TreeSet<String>> shotBased = convertListToShotBased();
    TreeMap<String, String> nameMap = SonyConstants.getCustomNamespaces(project);
    TreeSet<String> oldRef = new TreeSet<String>();
    TreeSet<String> newRef = new TreeSet<String>();

    for (String shot : shotBased.keySet()) {
      // check out the shot

      if (shot.endsWith("anim")) mclient.checkOut(w.user, w.view, shot, null, keep, frozU);
      else {
        continue;
        // mclient.checkOut(w.user, w.view, shot, null, keep, pFroz);
      }
      logLine("Checking out: " + shot);

      NodeMod targetMod = mclient.getWorkingVersion(w.user, w.view, shot);
      if (!shot.matches(lgtPattern)) {

        if (targetMod.isActionEnabled()) {
          System.err.println("Anim node with action enabled");
          FileSeq fseq = targetMod.getPrimarySequence();
          VersionID targetID = targetMod.getWorkingID();
          TreeMap<String, VersionID> files = new TreeMap<String, VersionID>();
          files.put(fseq.getFile(0).getPath(), targetID);
          mclient.revertFiles(w.user, w.view, shot, files);
          targetMod.setActionEnabled(false);
        }

        w.mclient.modifyProperties(w.user, w.view, targetMod);
      }

      /*--checking the shot to be modified---*/

      for (String assetToReplace : shotBased.get(shot)) {
        if (assetToReplace.endsWith(lr)) {
          AssetInfo temp = pAssetManager.get(assetToReplace);
          oldRef.add(assetToReplace);
          newRef.add(temp.getNewAsset());
        } else {
          String hiRes = assetToReplace.replace(lr, "");
          AssetInfo temp = pAssetManager.get(hiRes);
          if (temp == null) continue;
          oldRef.add(assetToReplace);
          newRef.add(temp.getNewAsset() + lr);
        } // end else
      } // end for

      if (oldRef.isEmpty() || newRef.isEmpty()) {
        logLine("Shot " + shot + " somehow does not need any changes.");
        continue;
      } // end if

      editShotReferences(shot, targetMod, oldRef, newRef, nameMap);
    } // end for

    /*for(String shot: shotBased.keySet()){
    	//TODO: Check in nodes
    	String msg = "Checked in with UpdateAssetGUI. Removed:\n\t";
    	for(String asset: oldRef)
    		msg+= (asset + " ");

    	msg+="\nAdded:\n\t";
    	for(String asset: newRef)
    		msg+= (asset + " ");

    	mclient.checkIn(w.user, w.view,shot, msg, VersionID.Level.Major);
    }*/

  } // end processShots