Skip to content

Commit

Permalink
Rework default mode and add extra mode.
Browse files Browse the repository at this point in the history
The default mode will now just output the current working line of the render, and the old default functionality has been moved to the 'extra' mode [-e].
  • Loading branch information
Dylancyclone committed Jun 27, 2019
1 parent dc29476 commit e951a8b
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions src/main/java/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class App {
public static String blenderPath;
public static String currFrame = "0";
public static boolean basicMode = false;
public static boolean extraMode = false;
public static Process proc;
public static boolean isRendering = false;
public static String currentJobFile;
Expand Down Expand Up @@ -78,8 +79,8 @@ public static void main(String[] args) throws IOException, InterruptedException
options.addOption("h", "help", false, "Show this message");
options.addOption("c", "client", false, "Instantly become a client");
options.addOption("m", "master", false, "Instantly become a master");
options.addOption("b", "basic", false, "Only show basic output (functionally identical)");
//options.addOption("e", "extra", false, "Show extra output (may be slower)");
options.addOption("b", "basic", false, "Only show basic output");
options.addOption("e", "extra", false, "Show extra output");
try {
// parse the command line arguments
CommandLine cmd = parser.parse(options, args);
Expand All @@ -93,6 +94,9 @@ public static void main(String[] args) throws IOException, InterruptedException
if(cmd.hasOption("b")) {
basicMode = true;
}
if(cmd.hasOption("e")) {
extraMode = true;
}
if(cmd.hasOption("c")) {
client();
}
Expand Down Expand Up @@ -537,24 +541,8 @@ private static int renderJobs(Collection<Job> jobs) throws IOException, Interrup
Pattern currFramePattern = Pattern.compile(currFrameRegex);
Matcher m;

if (!basicMode)
{
while((line = reader.readLine()) != null) {
//System.out.println(currFrame);
m = currFramePattern.matcher(line);
if (m.find()) {
System.out.print("\r"+line+"\n");
System.out.print("As of xx:xx:xx, X jobs containing X frames remaining"); // TODO: extra mode
}
else
{
System.out.print("\n"+line);
}
}
}
else
if (basicMode)
{

String blenderRenderRegex = "Part ([0-9]+)-([0-9]+)";
Pattern blenderRenderPattern = Pattern.compile(blenderRenderRegex);
Matcher blenderRenderMatch;
Expand Down Expand Up @@ -582,6 +570,26 @@ else if (cyclesRenderMatch.find()) {
}
}
}
else if (extraMode)
{
while((line = reader.readLine()) != null) {
System.out.println(line);
}
}
else
{
while((line = reader.readLine()) != null) {
m = currFramePattern.matcher(line);
if (m.find()) {
System.out.print("\r"+line);
}
}
}

if (!basicMode)
{
System.out.println();
}

proc.waitFor();
}
Expand Down

0 comments on commit e951a8b

Please sign in to comment.