Esempio n. 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)
Esempio n. 2
0
  /** Construct a new stage from the information contained in the node bundle. */
  @SuppressWarnings("deprecation")
  public BundleStage(
      StageInformation stageInfo,
      UtilContext context,
      MasterMgrClient client,
      NodeMod mod,
      TreeMap<String, BaseAnnotation> annotations,
      TreeMap<String, String> toolsetRemap,
      TreeMap<String, String> selectionKeyRemap,
      TreeMap<String, String> licenseKeyRemap,
      TreeMap<String, String> hardwareKeyRemap) {
    super("Bundle", "Description...", stageInfo, context, client, mod, StageFunction.aNone);

    pOrigNodeMod = mod;

    {
      String ntset = toolsetRemap.get(mod.getToolset());
      if (ntset != null) pRemappedToolset = ntset;
      else pRemappedToolset = super.getToolset();
    }

    JobReqs jreqs = mod.getJobRequirements();
    if (jreqs != null) {
      {
        TreeSet<String> selectionKeys = new TreeSet<String>();
        for (String key : jreqs.getSelectionKeys()) {
          String nkey = selectionKeyRemap.get(key);
          if (nkey != null) selectionKeys.add(nkey);
        }
        addSelectionKeys(selectionKeys);
      }

      {
        TreeSet<String> licenseKeys = new TreeSet<String>();
        for (String key : jreqs.getLicenseKeys()) {
          String nkey = licenseKeyRemap.get(key);
          if (nkey != null) licenseKeys.add(nkey);
        }
        addLicenseKeys(licenseKeys);
      }

      {
        TreeSet<String> hardwareKeys = new TreeSet<String>();
        for (String key : jreqs.getHardwareKeys()) {
          String nkey = hardwareKeyRemap.get(key);
          if (nkey != null) hardwareKeys.add(nkey);
        }
        addHardwareKeys(hardwareKeys);
      }
    }

    for (String aname : annotations.keySet()) addAnnotation(aname, annotations.get(aname));

    {
      TreeMap<String, BaseAnnotation> annots = mod.getAnnotations();
      for (String aname : annots.keySet()) addVersionAnnotation(aname, annots.get(aname));
    }
  }
Esempio n. 3
0
  /**
   * Get the primary file sequence of the working version of the node being viewed <CODE>null</CODE>
   * if no working version is being viewed.
   */
  public FileSeq getPrimarySequence() {
    if (pStatus != null) {
      NodeDetailsLight details = pStatus.getLightDetails();
      if (details != null) {
        NodeMod mod = details.getWorkingVersion();
        if (mod != null) return mod.getPrimarySequence();
      }
    }

    return null;
  }
Esempio n. 4
0
  /**
   * Updates the asset references for a shot within Maya and then in pipeline.
   *
   * @param shotName The name of the shot being processed.
   * @param pRemoveRef The list of assets being dereferenced from the shot.
   * @param pReplaceRef The list of assets being referenced into the shot.
   * @param nameMap
   */
  private void editShotReferences(
      String shotName,
      NodeMod targetMod,
      TreeSet<String> pRemoveRef,
      TreeSet<String> pReplaceRef,
      TreeMap<String, String> nameMap)
      throws PipelineException {
    logLine("Editing shot: " + shotName);
    boolean anim = !shotName.matches(lgtPattern);

    /* writing the mel script */
    if (anim) {
      File script = null;
      try {
        script = File.createTempFile("UpdateAssetGUI.", ".mel", PackageInfo.sTempPath.toFile());
        FileCleaner.add(script);
      } // end try
      catch (IOException ex) {
        throw new PipelineException(
            "Unable to create the temporary MEL script used to collect "
                + "texture information from the Maya scene!");
      } // end catch

      try {
        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(script)));

        for (String asset : pReplaceRef) {
          String nameSpace;
          if (asset.endsWith(lr))
            nameSpace = nameMap.get(getShortName(asset.substring(0, asset.length() - 3)));
          else {
            System.err.println("This should not be happening, a hi res asset in a lo-res node.");
            continue;
            // nameSpace = nameMap.get(getShortName(asset));
          }
          out.println("print (\"referencing file: $WORKING" + asset + ".ma\");");
          out.println(
              "file -reference -namespace \"" + nameSpace + "\" \"$WORKING" + asset + ".ma\";");
        } // end for

        for (String asset : pRemoveRef) {
          out.println("print (\"dereferencing file: $WORKING" + asset + ".ma\");");
          out.println("file -rr \"$WORKING" + asset + ".ma\";");
        } // end for

        out.println("// SAVE");
        out.println("file -save;");

        out.close();
      } // end try
      catch (IOException ex) {
        throw new PipelineException(
            "Unable to write the temporary MEL script(" + script + ") used add the references!");
      } // end catch

      NodeID targetID = new NodeID(w.user, w.view, shotName);
      // NodeStatus targetStat = mclient.status(targetID);

      /* run Maya to collect the information */
      try {

        Path targetPath = getNodePath(shotName);
        ArrayList<String> args = new ArrayList<String>();
        args.add("-batch");
        args.add("-script");
        args.add(script.getPath());
        args.add("-file");
        args.add(targetPath.toOsString());

        Path wdir = new Path(PackageInfo.sProdPath.toOsString() + targetID.getWorkingParent());

        TreeMap<String, String> env =
            mclient.getToolsetEnvironment(
                w.user, w.view, targetMod.getToolset(), PackageInfo.sOsType);

        Map<String, String> nenv = env;
        String midefs = env.get("PIPELINE_MI_SHADER_PATH");
        if (midefs != null) {
          nenv = new TreeMap<String, String>(env);
          Path dpath = new Path(new Path(wdir, midefs));
          nenv.put("MI_CUSTOM_SHADER_PATH", dpath.toOsString());
        }

        String command = "maya";
        if (PackageInfo.sOsType.equals(OsType.Windows)) command += ".exe";

        SubProcessLight proc =
            new SubProcessLight("UpdateAssetGUI", command, args, env, wdir.toFile());
        try {
          proc.start();
          proc.join();
          if (!proc.wasSuccessful()) {
            throw new PipelineException(
                "Did not correctly edit the reference due to a maya error.!\n\n"
                    + proc.getStdOut()
                    + "\n\n"
                    + proc.getStdErr());
          } // end if
        } // end try
        catch (InterruptedException ex) {
          throw new PipelineException(ex);
        } // end catch
      } // end try
      catch (Exception ex) {
        throw new PipelineException(ex);
      } // end catch
    }

    /*-edit the references in pipeline once they are done in the file-*/
    BaseAction targetAction = targetMod.getAction();
    for (String asset : pReplaceRef) {
      mclient.link(
          w.user, w.view, shotName, asset, LinkPolicy.Reference, LinkRelationship.All, null);
      if (anim) {
        /*Set the namespaces*/
        String nameSpace = nameMap.get(getShortName(asset.substring(0, asset.length() - 3)));
        System.err.println(nameSpace);
        targetAction.initSourceParams(asset);
        targetAction.setSourceParamValue(asset, "PrefixName", nameSpace);
        targetMod.setAction(targetAction);
      }
    }
    w.mclient.modifyProperties(w.user, w.view, targetMod);

    for (String asset : pRemoveRef) mclient.unlink(w.user, w.view, shotName, asset);

    if (!anim) {
      System.err.println("Queuing the switchLgt node " + shotName);
      mclient.submitJobs(w.user, w.view, shotName, null);
    }
  } // end editShotReferences
Esempio n. 5
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
 private static void doReqs(NodeMod mod) throws PipelineException {
   JobReqs req = mod.getJobRequirements();
   req.addSelectionKey("Lair");
   mod.setJobRequirements(req);
 }
  /** @param args */
  public static void main(String[] args) {
    String user = "******";
    String view = "build";
    String toolset = "csg_rev18";
    MasterMgrClient client = new MasterMgrClient();
    Wrapper w = null;
    String project = "lr";

    try {
      w = new Wrapper(user, view, toolset, client);
      PluginMgrClient.init();
    } catch (PipelineException e1) {
      e1.printStackTrace();
    }

    String baseModel = "/projects/lr/assets/prop/asylianHelmet/asylianHelmet";
    String finalizeMel = "/projects/lr/assets/tools/mel/finalize-character";

    int pass = 3;

    LinkedList<String> toAdd = new LinkedList<String>();
    for (int i = 2; i <= 10; i++) {
      toAdd.add("asylianHelmet" + i);
    }
    if (pass == 1) {
      try {
        SonyAsset baseAsset = SonyConstants.stringToAsset(w, baseModel);
        Globals.getNewest(
            w, baseAsset.finalScene, CheckOutMode.OverwriteAll, CheckOutMethod.AllFrozen);
        Globals.getNewest(
            w, baseAsset.lr_finalScene, CheckOutMode.OverwriteAll, CheckOutMethod.AllFrozen);

        AssetType baseType = baseAsset.assetType;

        for (String name : toAdd) {
          TreeSet<String> addedNodes = new TreeSet<String>();
          try {
            SonyAsset as = new SonyAsset(project, name, baseType);

            log(as.texGroup + " : ");
            if (!Globals.doesNodeExists(w, as.texGroup)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.texGroup, null, Plugins.editorKWrite(w));
              addedNodes.add(as.texGroup);
              BaseAction act = Plugins.actionListSources(w);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.matScene + " : ");
            if (!Globals.doesNodeExists(w, as.matScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.matScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.matScene);
              BaseAction act = Plugins.actionMayaReference(w);
              Globals.referenceNode(w, as.matScene, baseAsset.rigScene, act, REF, "rig");
              client.link(user, view, as.matScene, as.texGroup, REF, LINKALL, null);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.finalScene + " : ");
            if (!Globals.doesNodeExists(w, as.finalScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.finalScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.finalScene);
              BaseAction act = Plugins.actionMayaImport(w);
              Globals.referenceNode(w, as.finalScene, as.matScene, act, DEP, "mat");
              client.link(user, view, as.finalScene, finalizeMel, DEP, LINKALL, null);
              act.setSingleParamValue("ModelMEL", finalizeMel);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.lr_matScene + " : ");
            if (!Globals.doesNodeExists(w, as.lr_matScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.lr_matScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.lr_matScene);
              BaseAction act = Plugins.actionMayaReference(w);
              Globals.referenceNode(w, as.lr_matScene, baseAsset.lr_rigScene, act, REF, "rig");
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            log(as.lr_finalScene + " : ");
            if (!Globals.doesNodeExists(w, as.lr_finalScene)) {
              logLine("Building");
              NodeMod mod = Globals.registerNode(w, as.lr_finalScene, "ma", Plugins.editorMaya(w));
              addedNodes.add(as.lr_finalScene);
              BaseAction act = Plugins.actionMayaImport(w);
              Globals.referenceNode(w, as.lr_finalScene, as.lr_matScene, act, DEP, "mat");
              client.link(user, view, as.lr_finalScene, finalizeMel, DEP, LINKALL, null);
              act.setSingleParamValue("ModelMEL", finalizeMel);
              mod.setAction(act);
              doReqs(mod);
              client.modifyProperties(user, view, mod);
            } else logLine("Already Exists");

            try {
              client.submitJobs(user, view, as.finalScene, null);
              client.submitJobs(user, view, as.lr_finalScene, null);
            } catch (PipelineException ex) {
              ex.printStackTrace();
            }

          } catch (PipelineException ex) {
            try {
              Globals.releaseNodes(w, addedNodes);
            } catch (PipelineException e) {
              e.printStackTrace();
            }
            ex.printStackTrace();
            return;
          }
        }

      } catch (PipelineException e) {
        e.printStackTrace();
      }
    } else if (pass == 2) {
      for (String name : toAdd) {
        try {
          logLine(name);
          SonyAsset baseAsset = SonyConstants.stringToAsset(w, baseModel);
          AssetType baseType = baseAsset.assetType;
          SonyAsset as = new SonyAsset(project, name, baseType);
          Globals.disableAction(w, as.matScene);
          Globals.disableAction(w, as.lr_matScene);
        } catch (PipelineException e) {
          e.printStackTrace();
        }
      }

    } else if (pass == 3) {
      for (String name : toAdd) {
        try {
          logLine(name);
          SonyAsset baseAsset = SonyConstants.stringToAsset(w, baseModel);
          AssetType baseType = baseAsset.assetType;
          SonyAsset as = new SonyAsset(project, name, baseType);
          NodeID nodeID = new NodeID(user, view, as.finalScene);

          client.checkIn(
              nodeID,
              "Inital model tree built by the BuildDerivedModels tool.  Built off the "
                  + baseModel
                  + " model",
              VersionID.Level.Minor);

          nodeID = new NodeID(user, view, as.lr_finalScene);
          client.checkIn(
              nodeID,
              "Inital model tree built by the BuildDerivedModels tool.  Built off the "
                  + baseModel
                  + " model",
              VersionID.Level.Minor);
        } catch (PipelineException e) {
          e.printStackTrace();
        }
      }
    }
  }
Esempio n. 8
0
  /** Add the UI components for the given file sequence to the panel. */
  private void addFileSeqPanel(FileSeq fseq) {
    boolean isPresentInWorking = false;
    if ((pStatus != null) && pStatus.hasLightDetails()) {
      NodeDetailsLight details = pStatus.getLightDetails();
      NodeMod mod = details.getWorkingVersion();
      if (mod != null) {
        if (mod.getPrimarySequence().equals(fseq)) isPresentInWorking = true;
        else {
          for (FileSeq sfseq : mod.getSecondarySequences()) {
            if (sfseq.equals(fseq)) {
              isPresentInWorking = true;
              break;
            }
          }
        }
      }
    }

    /* collate the row information */
    ArrayList<VersionID> vids = new ArrayList<VersionID>();
    ArrayList<FileSeq> singles = new ArrayList<FileSeq>();
    TreeSet<FileSeq> enabled = new TreeSet<FileSeq>();
    TreeMap<FileSeq, FileState> fstates = new TreeMap<FileSeq, FileState>();
    TreeMap<FileSeq, NativeFileInfo> finfos = new TreeMap<FileSeq, NativeFileInfo>();
    TreeMap<FileSeq, QueueState> qstates = new TreeMap<FileSeq, QueueState>();
    TreeMap<FileSeq, Boolean[]> novel = new TreeMap<FileSeq, Boolean[]>();
    {
      TreeMap<FileSeq, Integer> wsingles = new TreeMap<FileSeq, Integer>();
      if ((pStatus != null) && pStatus.hasLightDetails()) {
        if (isPresentInWorking) {
          if (pStatus.hasHeavyDetails()) {
            NodeDetailsHeavy details = pStatus.getHeavyDetails();

            FileState[] fs = details.getFileStates(fseq);
            QueueState[] qs = details.getQueueStates();
            NativeFileInfo[] infos = details.getFileInfos(fseq);
            if ((fs != null) && (qs != null) && (infos != null)) {
              int wk;
              for (wk = 0; wk < fs.length; wk++) {
                FileSeq sfseq = new FileSeq(fseq, wk);
                wsingles.put(sfseq, wk);

                fstates.put(sfseq, fs[wk]);
                finfos.put(sfseq, infos[wk]);
                qstates.put(sfseq, qs[wk]);

                if (fs[wk] != FileState.CheckedIn) enabled.add(sfseq);
              }
            }
          } else {
            NodeDetailsLight details = pStatus.getLightDetails();

            int wk;
            for (wk = 0; wk < fseq.numFrames(); wk++) {
              FileSeq sfseq = new FileSeq(fseq, wk);
              wsingles.put(sfseq, wk);

              if (details.getVersionState() == VersionState.CheckedIn) {
                fstates.put(sfseq, FileState.CheckedIn);
                qstates.put(sfseq, QueueState.Undefined);
              } else {
                enabled.add(sfseq);
              }
            }
          }
        }

        {
          vids.addAll(pNovelty.keySet());
          Collections.reverse(vids);

          int idx = 0;
          for (VersionID vid : vids) {
            TreeMap<FileSeq, boolean[]> table = pNovelty.get(vid);
            for (FileSeq nfseq : table.keySet()) {
              if (fseq.similarTo(nfseq)) {
                boolean[] flags = table.get(nfseq);

                int wk;
                for (wk = 0; wk < flags.length; wk++) {
                  FileSeq sfseq = new FileSeq(nfseq, wk);
                  if (!wsingles.containsKey(sfseq)) wsingles.put(sfseq, null);

                  Boolean[] rflags = novel.get(sfseq);
                  if (rflags == null) {
                    rflags = new Boolean[pNovelty.size()];
                    novel.put(sfseq, rflags);
                  }

                  rflags[idx] = new Boolean(flags[wk]);
                }

                break;
              }
            }

            idx++;
          }
        }
      }

      TreeMap<Integer, FileSeq> order = new TreeMap<Integer, FileSeq>();
      for (FileSeq sfseq : wsingles.keySet()) {
        int frame = -1;
        if (sfseq.hasFrameNumbers()) frame = sfseq.getFrameRange().getStart();

        order.put(frame, sfseq);
      }

      singles.addAll(order.values());
    }

    /* add the panel */
    {
      JFileSeqPanel panel =
          new JFileSeqPanel(
              this,
              pManagerPanel,
              pStatus,
              pPrivilegeDetails,
              fseq,
              vids,
              pOffline,
              singles,
              fstates,
              finfos,
              qstates,
              enabled,
              novel,
              pIsListLayout);

      if (pIsListLayout) pFileSeqsBox.add(panel);
      else pFileSeqsTab.addTab(fseq.getFilePattern().toString(), sTabIcon, panel);

      pFileSeqPanels.put(fseq, panel);
    }
  }
  /**
   * Perform execution of the tool.
   *
   * <p>
   *
   * @param mclient The network connection to the plmaster(1) daemon.
   * @param qclient The network connection to the plqueuemgr(1) daemon.
   * @return Whether to continue and collect user input for the next phase of the tool.
   * @throws PipelineException If unable to sucessfully execute this phase of the tool.
   */
  public synchronized boolean executePhase(MasterMgrClient mclient, QueueMgrClient qclient)
      throws PipelineException {
    boolean newCheckOut = false;
    String matName = null;
    String texName = null;

    {
      /*find out if it is a fresh checkout*/
      JToolDialog tool = new JToolDialog("MaterialsCheckOut", new JPanel(), "Continue");
      JConfirmDialog dialog = new JConfirmDialog(tool, "Do you want a completely fresh checkout");
      dialog.setVisible(true);
      newCheckOut = dialog.wasConfirmed();
    }

    {
      /*-check out the asset and mat nodes-*/
      jcheckOut(mclient, pUser, pView, pPrimary, null, keep, pFroz);
      NodeMod assetMod = mclient.getWorkingVersion(pUser, pView, pPrimary);
      {
        JobReqs jreqs = assetMod.getJobRequirements();
        jreqs.addSelectionKey("LinuxOnly");
        assetMod.setJobRequirements(jreqs);
        mclient.modifyProperties(pUser, pView, assetMod);
      }

      Set<String> assetSrcs = assetMod.getSourceNames();
      err.println("The asset sources are: ");

      for (String src : assetSrcs) {
        err.println(src);

        if (src.matches(matPattern)) {
          matName = src;
          err.println("Found mat node:\n\t " + src);
          if (newCheckOut) {
            err.println("Clean mat checkout");
            jcheckOut(mclient, pUser, pView, src, null, over, frozU);
          } else {

            OverallNodeState state =
                mclient.status(pUser, pView, src).getHeavyDetails().getOverallNodeState();

            if (!state.equals(OverallNodeState.Modified)) {
              err.println("Mat node has not been modified");
              jcheckOut(mclient, pUser, pView, src, null, keep, pFroz);
            }
          }
        } else if (src.matches(matPattern + "Exp")) {
          err.println("Matexp is:\n\t" + src);
          jcheckOut(mclient, pUser, pView, src, null, keep, modi);
          {
            NodeMod expMod = mclient.getWorkingVersion(pUser, pView, src);
            JobReqs jreqs = expMod.getJobRequirements();
            jreqs.addSelectionKey("LinuxOnly");
            expMod.setJobRequirements(jreqs);
            mclient.modifyProperties(pUser, pView, expMod);
          }
        } else {
          jcheckOut(mclient, pUser, pView, src, null, over, froz);
        }
      } // end for
      err.println("mat node: " + matName);
      if (matName == null)
        throw new PipelineException("This asset node does not have an " + "attached mat node");
    }

    {
      /*find the texture node and check out so it can be changed. If new checkout, fresh textures*/
      NodeMod matMod = mclient.getWorkingVersion(pUser, pView, matName);
      TreeSet<String> matSrcs = new TreeSet<String>(matMod.getSourceNames());
      for (String src : matSrcs) {
        if (src.matches(texPattern)) {
          texName = src;
          err.println("Found tex node:\n\t " + src);
          if (newCheckOut) {
            err.println("Clean");
            jcheckOut(mclient, pUser, pView, src, null, over, frozU);
          } else {
            err.println("Old stuff");
            jcheckOut(mclient, pUser, pView, src, null, keep, pFroz);
            jcheckOut(mclient, pUser, pView, src, null, keep, modi);
          }
          continue;
        } // end if
        jcheckOut(mclient, pUser, pView, src, null, over, froz);
      } // end for
      err.println("tex node: " + texName);
      if (texName == null)
        throw new PipelineException(
            "This asset node does not have an associated " + "texture node");
    }

    err.println("Checked out the asset, mat and texture nodes");

    {
      /*check out finalise scripts*/
      jcheckOut(
          mclient,
          pUser,
          pView,
          "/projects/lr/assets/tools/mel/finalize-character",
          null,
          over,
          froz);
      jcheckOut(
          mclient, pUser, pView, "/projects/lr/assets/tools/mel/finalize-set", null, over, froz);
      jcheckOut(
          mclient, pUser, pView, "/projects/lr/assets/tools/mel/finalize-prop", null, over, froz);
    }

    err.close();

    return false;
  } // end executePhase
Esempio n. 10
0
  @Override
  public void run(String[] args) {
    try {
      TreeMap<String, LinkedList<String>> parsedArgs = argParser(args);
      if (!checkArgsAndSetParams(parsedArgs)) {
        return;
      }
    } catch (PipelineException ex) {
      System.err.println("There was a problem reading the arguments.\n" + ex.getMessage());
      printHelp();
      return;
    }

    for (String turntableName : turntables) {
      logLine("Doing turntable: " + turntableName);
      for (String passName : passes) {
        logLine("\tDoing pass: "******"\t\tDoing asset: " + as.assetName);
            LairTurntable tt = new LairTurntable(as, turntableName, passName);
            w = new Wrapper(user, view, toolset, client);

            logLine("\t\tFreezing all the textures");
            getLatest(w, as.texGroup, over, froz);

            logLine("\t\tChecking out the final model scene");
            getNewest(w, as.finalScene, keep, pFroz);
            getNewest(w, as.lr_finalScene, keep, pFroz);

            logLine("\t\tChecking out the shader scene.");
            getNewest(w, as.shdScene, keep, pFroz);

            logLine("\t\tChecking out the turntable scene.");
            getNewest(w, tt.turntableScene, keep, pFroz);

            logLine("\t\tChecking out the overRide scene.");
            getNewest(w, tt.ttCamOverMI, keep, pFroz);

            logLine("\t\tChecking out the options scene.");
            getNewest(w, tt.ttOptionsMI, keep, pFroz);

            logLine("\t\tChecking out the camera MI node.");
            getNewest(w, tt.ttCamMI, keep, pFroz);

            logLine("\t\tChecking out the light MI node.");
            getNewest(w, tt.ttLightMI, keep, pFroz);

            logLine("\t\tChecking out the shade MI node.");
            getNewest(w, tt.ttShadeMI, keep, pFroz);

            logLine("\t\tChecking out the geo MI node.");
            getNewest(w, tt.ttGeoMI, keep, pFroz);

            logLine("\t\tChecking out the images node.");
            getNewest(w, tt.ttImages, keep, pFroz);

            logLine("\t\tFixing the turntable node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.turntableScene);
              if (toolset != null) mod.setToolset(toolset);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the camera override node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttCamOverMI);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              act.setSingleParamValue("ImageWidth", 1280);
              act.setSingleParamValue("ImageHeight", 720);
              act.setSingleParamValue("AspectRatio", 1.777);
              act.setSingleParamValue("Aperture", 1.41732);
              act.setSingleParamValue("OverrideFocal", false);
              act.setSingleParamValue("OverrideClipping", false);
              mod.setAction(act);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the camera node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttCamMI);
              if (toolset != null) mod.setToolset(toolset);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the light node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttLightMI);
              if (toolset != null) mod.setToolset(toolset);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the geo node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttGeoMI);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              act.setSingleParamValue("CustomText", true);
              mod.setAction(act);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the shader node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttShadeMI);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              BaseAction act2 = LairConstants.actionMayaMiShader();
              act2.setSingleParamValues(act);
              mod.setAction(act2);
              JobReqs req = mod.getJobRequirements();
              req.addSelectionKey("MentalRay");
              mod.setJobRequirements(req);
              mod.setExecutionMethod(ExecutionMethod.Parallel);
              mod.setBatchSize(100);
              client.modifyProperties(user, view, mod);
            }

            logLine("\t\tFixing the images node");
            {
              NodeMod mod = client.getWorkingVersion(user, view, tt.ttImages);
              if (toolset != null) mod.setToolset(toolset);
              BaseAction act = mod.getAction();
              act.setSingleParamValue("TexturePath", "$WORKING");
              mod.setAction(act);
              JobReqs req = mod.getJobRequirements();
              req.addSelectionKey("MentalRay");
              mod.setJobRequirements(req);
              mod.setExecutionMethod(ExecutionMethod.Parallel);
              mod.setBatchSize(5);
              client.modifyProperties(user, view, mod);
            }

            logLine(
                "All Done.  Remember to set your export set on the mod node "
                    + "if you want to export a custom part of the body");
          } catch (PipelineException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      }
    }
  }
Esempio n. 11
0
  private boolean dylanate(
      MasterMgrClient mclient,
      String switchName,
      DoubleMap<String, String, TreeSet<VersionID>> plugs)
      throws PipelineException {
    err.println("\nProcessing: " + switchName);
    String animName = null;

    {
      NodeMod switchMod = null;
      try {
        switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      } catch (PipelineException e) {
        mclient.checkOut(pUser, pView, switchName, null, keep, pFroz);
        switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      }

      TreeSet<String> switchSrcs = new TreeSet<String>(switchMod.getSourceNames());

      for (String src : switchSrcs) {
        if (src.matches(animPattern)) {
          animName = src;
          err.println("Found anim node: " + src);
          mclient.checkOut(pUser, pView, src, null, over, frozU);
          continue;
        } // end if

        mclient.checkOut(pUser, pView, src, null, over, frozU);

        LinkMod lMod = switchMod.getSource(src);
        LinkPolicy rel = lMod.getPolicy();
        System.err.println(src + ": " + rel);
        if (!rel.equals(REF)) {
          System.err.println("umm");
          lMod.setPolicy(REF);
          switchMod.setSource(lMod);
          mclient.modifyProperties(pUser, pView, switchMod);
        }
      } // end for

      err.println("anim node: " + animName);

      mclient.modifyProperties(pUser, pView, switchMod);

      if (animName == null)
        throw new PipelineException("This switch node does not have an associated anim node");
    }
    err.println("Checked out the anim and switch nodes");

    String actionName = null;
    VersionID ttVer = null;
    boolean toCache = false;

    /*change the action setting on the Switch node*/
    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);

      Path p = new Path(switchName);
      Path syfRoot = new Path(p.getParentPath().getParentPath(), "syf");
      System.err.println("Going to look for caches in: " + syfRoot);
      ArrayList<String> syfDirs = getChildrenDirs(mclient, syfRoot.toString());

      for (String dir : syfDirs) {
        System.err.println(dir);
        Path dPath = new Path(syfRoot, dir);
        ArrayList<String> simDir = getChildrenNodes(mclient, dPath.toString());
        for (String pCache : simDir) {
          Path cPath = new Path(dPath, pCache);
          if (cPath.toString().matches(cltPattern)) {
            System.err.println("\t" + cPath.toString());
            try {
              mclient.checkOut(pUser, pView, cPath.toString(), null, over, froz);
              mclient.lock(pUser, pView, cPath.toString(), null);
              mclient.link(pUser, pView, switchMod.getName(), cPath.toString(), DEP, LINKALL, null);
            } catch (PipelineException e) {
              e.printStackTrace();
            }
            toCache = true;
          }
        }
      }

      {
        BaseAction action = switchMod.getAction();
        if (!switchMod.getToolset().equals(pToolset)) {
          switchMod.setToolset(pToolset);
          mclient.modifyProperties(pUser, pView, switchMod);
        }

        if (!toCache) {
          actionName = modRep;
        } else {
          actionName = modRep + "Syflex";
        }
        ttVer = plugs.get("SCEA", actionName).last();

        if ((action == null)
            || (!action.getName().equals(actionName))
            || (!action.getVersionID().equals(ttVer))) {
          System.err.println(
              "Action name is incorrect - the switch node "
                  + switchName
                  + " doesn't have a "
                  + actionName
                  + "Action");

          action = plug.newAction(actionName, ttVer, "SCEA");
          action.setSingleParamValue("Source", animName);
          action.setSingleParamValue("Response", "Ignore");
          if (toCache) action.setSingleParamValue(aApplyCache, true);
          switchMod.setAction(action);
          mclient.modifyProperties(pUser, pView, switchMod);
        } else {
          if (!action.getSingleParamValue("Response").equals("Ignore")) {
            //						action = plug.newAction(actionName, ttVer, "SCEA");
            //						action.setSingleParamValue("Source", animName);
            action.setSingleParamValue("Response", "Ignore");
            //						if(toCache)
            //						action.setSingleParamValue(aApplyCache, true);
            switchMod.setAction(action);
            mclient.modifyProperties(pUser, pView, switchMod);
          } // end if
        } // end else
      }
    }

    {
      /*-check out and lock the animation sources-*/
      NodeMod animMod = mclient.getWorkingVersion(pUser, pView, animName);
      Set<String> animSrcs = animMod.getSourceNames();
      for (String src : animSrcs) {
        if (src.matches(loresPattern)) {
          pLoresSrcs.add(src);
          err.println("Adding lores src " + src);
        }
        mclient.checkOut(pUser, pView, src, null, keep, pFroz);
      } // end for
      err.println("lores:" + pLoresSrcs);
    }

    /*-sync the animation assets with the switch assets.*/
    // also remove unnecessary hires models
    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      for (String src : switchMod.getSourceNames()) {
        if (src.matches(hiresPattern)) {
          err.println("Found hires source " + src);
          if (pLoresSrcs.contains(src + "_lr")) {
            pHiresSrcs.add(src);
            err.println("The hires source matched the anim node.");
          } else {
            err.println("Gotta remove " + src);
          } // end else
        } // end if
      } // end for
    }

    // add necessary hires models
    for (String lores : pLoresSrcs) {
      String hr = lores.replace("_lr", "");
      err.println("Looking at lores source " + lores + " which matches " + hr);
      if (!pHiresSrcs.contains(hr)) {
        err.println("Gotta add " + hr + " to " + switchName);
        pHiresSrcs.add(hr);
      }
    }

    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      TreeSet<String> switchSrcs = new TreeSet<String>(switchMod.getSourceNames());
      err.println("Final hiRes list:" + pHiresSrcs + "\n");
      err.println("switch now has:\n\t" + switchSrcs + "\n");
      err.println("Looking for things to add.");
      for (String src : pHiresSrcs) {
        if ((src.matches(hiresPattern) && (!switchSrcs.contains(src)))) {
          err.print("Linking ");
          mclient.checkOut(pUser, pView, src, null, over, frozU);
          mclient.link(pUser, pView, pPrimary, src, REF, LINKALL, null);
          switchSrcs.add(src);
        }
        err.println("src from hiRes list: " + src);
      }
    }

    {
      NodeMod switchMod = mclient.getWorkingVersion(pUser, pView, switchName);
      TreeSet<String> switchSrcs = new TreeSet<String>(switchMod.getSourceNames());
      err.println("switch now has:\n\t" + switchSrcs + "\n");
      for (String src : switchSrcs) {
        if ((src.matches(hiresPattern) && (!pHiresSrcs.contains(src)))) {
          err.print("Unlinking ");
          mclient.unlink(pUser, pView, pPrimary, src);
        }
        err.println("src from switch node list: " + src);
      }
    }

    /*queue the switch node*/
    mclient.submitJobs(pUser, pView, switchName, null);

    return false;
  }