Skip to content

Commit

Permalink
Merge pull request #40 from LogicReinc/dev-1.1.2
Browse files Browse the repository at this point in the history
Dev 1.1.2
  • Loading branch information
LogicReinc authored Jun 5, 2022
2 parents 1fbb298 + 9aa2483 commit dd9a419
Show file tree
Hide file tree
Showing 34 changed files with 1,009 additions and 500 deletions.
Binary file added .data/BlendFarm.Server-1.1.1.1-Linux64.zip
Binary file not shown.
30 changes: 30 additions & 0 deletions .data/announcements.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
[
{
"Date": "2022-06-04",
"Name": "Version 1.1.2 is out! Animation File Formats, OpenSSL3.x Support",
"Segments": [
{
"Type": "Text",
"Text": "V1.1.2 restructures some code, and now allows animations to be rendered to specific file formats (eg. EXR). Some formats will not have previews in app. Besides file formats it also updates the runtime to .NET6, which now should support OpenSSL3.x which some Linux distros decided on changing to"
},
{
"Type": "Image",
"Text": "https://raw.githubusercontent.com/LogicReinc/LogicReinc.BlendFarm/dev-1.1.2/.data/v112.JPG"
},
{
"Type": "Text",
"Text": "If you find BlendFarm productive, please consider dropping a donation on Patreon!"
},
{
"Type": "Button",
"Text": "Open Releases|https://github.com/LogicReinc/LogicReinc.BlendFarm/releases"
},
{
"Type": "Button",
"Text": "https://raw.githubusercontent.com/LogicReinc/LogicReinc.BlendFarm/dev-1.0.7/.data/patreon.png|https://www.patreon.com/LogicReinc"
},
{
"Type": "Empty",
"Text": ""
}
]
},
{
"Date": "2022-04-27",
"Name": "Version 1.1.1 is out! Animation performance improvements",
Expand Down
Binary file added .data/v112.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions LogicReinc.BlendFarm.Client/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
[assembly: Guid("274bf838-c9be-41e7-a14c-75c8575f1f61")]


[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
28 changes: 22 additions & 6 deletions LogicReinc.BlendFarm.Client/BlendFarmManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using LogicReinc.BlendFarm.Shared;
using LogicReinc.BlendFarm.Client.Tasks;
using LogicReinc.BlendFarm.Shared;
using LogicReinc.BlendFarm.Shared.Communication.RenderNode;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -518,10 +519,10 @@ await Task.WhenAll(Nodes.ToList().Select(async node =>
/// <summary>
/// Creates a RenderTask for the currently connected nodes, not yet executed
/// </summary>
public RenderTask GetRenderTask(string file, RenderManagerSettings settings = null, Action<RenderSubTask, Bitmap> onResultUpdated = null, Action<RenderSubTask, Bitmap> onTileReceived = null)
public RenderTask GetImageTask(string file, RenderManagerSettings settings = null, Action<RenderSubTask, Image> onResultUpdated = null, Action<RenderSubTask, Image> onTileReceived = null)
{
BlendFarmFileSession session = GetOrCreateSession(file);
CurrentTask = new RenderTask(Nodes.ToList(), session.SessionID, Version, session.FileID, settings);
CurrentTask = RenderTask.GetImageRenderTask(Nodes.ToList(), session.SessionID, Version, session.FileID, settings);

if (onResultUpdated != null)
CurrentTask.OnResultUpdated += onResultUpdated;
Expand All @@ -531,6 +532,17 @@ public RenderTask GetRenderTask(string file, RenderManagerSettings settings = nu
return CurrentTask;
}

public RenderTask GetAnimationTask(string file, int start, int end,RenderManagerSettings settings = null, Action<RenderSubTask, SubTaskResult> onResult = null)
{
BlendFarmFileSession session = GetOrCreateSession(file);
CurrentTask = new AnimationTask(Nodes.ToList(), session.SessionID, Version, session.FileID, start, end, settings);

if (onResult != null)
((AnimationTask)CurrentTask).OnFrameResult += onResult;

return CurrentTask;
}

public void SetSelectedSessionID(string sessionID)
{
SelectedSessionID = sessionID;
Expand All @@ -546,15 +558,19 @@ public void ClearLastTask()
/// <summary>
/// Render with provided settings on connected prepared nodes
/// </summary>
public async Task<Bitmap> Render(string file, RenderManagerSettings settings = null, Action<RenderSubTask, Bitmap> onResultUpdated = null, Action<RenderSubTask, Bitmap> onTileReceived = null)
public async Task<Image> Render(string file, RenderManagerSettings settings = null, Action<RenderSubTask, Image> onResultUpdated = null, Action<RenderSubTask, Image> onTileReceived = null)
{
if (CurrentTask != null)
throw new InvalidOperationException("Already rendering..");
try
{
CurrentTask = GetRenderTask(file, settings, onResultUpdated, onTileReceived);
CurrentTask = GetImageTask(file, settings, onResultUpdated, onTileReceived);

await CurrentTask.Render();

Image bitmap = ((CurrentTask is IImageTask) ? (IImageTask)CurrentTask : null)?.FinalImage;

return await CurrentTask.Render();
return bitmap;
}
finally
{
Expand Down
18 changes: 18 additions & 0 deletions LogicReinc.BlendFarm.Client/ImageTypes/DefaultImageConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LogicReinc.BlendFarm.Client.ImageTypes
{
public class DefaultImageConverter : IImageConverter
{
public Image FromStream(Stream str)
{
return new Bitmap(Bitmap.FromStream(str));
}
}
}
41 changes: 41 additions & 0 deletions LogicReinc.BlendFarm.Client/ImageTypes/IImageConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LogicReinc.BlendFarm.Client.ImageTypes
{
public static class ImageConverter
{
public static DefaultImageConverter Default { get; } = new DefaultImageConverter();

public static Image Convert(byte[] bytes, string format)
{
using (MemoryStream str = new MemoryStream(bytes))
return Convert(str, format);
}
public static Image Convert(Stream str, string format)
{
format = format.ToUpper().Trim();
switch (format)
{
case "":
case "BMP":
case "PNG":
case "JPEG":
case "TIFF":
return Default.FromStream(str);
default:
return null;
}
}
}

public interface IImageConverter
{
Image FromStream(Stream str);
}
}
35 changes: 35 additions & 0 deletions LogicReinc.BlendFarm.Client/ImageTypes/ImageFormats.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LogicReinc.BlendFarm.Client.ImageTypes
{
public class ImageFormats
{
public static string[] Formats = new string[] { "BMP", "PNG", "JPEG", "JPEG2000", "TARGA", "TARGA_RAW", "CINEON", "DPX", "OPEN_EXR_MULTILAYER", "OPEN_EXR", "HDR", "TIFF" };
public static string[] Extensions => _extensions.Values.ToArray();
private static Dictionary<string, string> _extensions = new Dictionary<string, string>()
{
{ "BMP", "bmp" },
{ "PNG", "png" },
{ "JPEG", "jpg"},
{ "JPEG2000", "jpg"},
{ "TARGA", "tga"},
{ "TARGA_RAW", "tga" },
{ "CINEON", "cin" },
{ "DPX", "dpx" },
{ "OPEN_EXR_MULTILAYER", "exr"},
{ "OPEN_EXR", "exr"},
{ "HDR", "hdr" },
{ "TIFF", "tif"}
};

public static string GetExtension(String format)
{
if (_extensions.ContainsKey(format))
return _extensions[format];
return null;
}
}
}
5 changes: 5 additions & 0 deletions LogicReinc.BlendFarm.Client/RenderManagerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public class RenderManagerSettings
/// </summary>
public EngineType Engine { get; set; } = EngineType.Cycles;

/// <summary>
/// Format to render to
/// </summary>
public string RenderFormat { get; set; } = "";

/// <summary>
/// A sad requirement that works around a problem in Blender.
/// Blender doesn't properly update before rendering in subsequent tasks in a batch
Expand Down
6 changes: 4 additions & 2 deletions LogicReinc.BlendFarm.Client/RenderSubTask.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using LogicReinc.BlendFarm.Shared;
using LogicReinc.BlendFarm.Client.Tasks;
using LogicReinc.BlendFarm.Shared;
using LogicReinc.BlendFarm.Shared.Communication.RenderNode;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -112,7 +113,8 @@ public RenderPacketModel ToRenderPacketModel()
TaskID = ID,
Engine = Parent.Settings.Engine,
Workaround = Parent.Settings.BlenderUpdateBugWorkaround,
Crop = Crop || Parent.Settings.BlenderUpdateBugWorkaround
Crop = Crop || Parent.Settings.BlenderUpdateBugWorkaround,
RenderFormat = (Parent is AnimationTask) ? Parent.Settings.RenderFormat : ""
};
}
}
Expand Down
Loading

0 comments on commit dd9a419

Please sign in to comment.