Ejemplo n.º 1
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();
          }
        }
      }
    }
  }
Ejemplo n.º 2
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;
  }