stringless icon indicating copy to clipboard operation
stringless copied to clipboard

Using Blender instead of Maya

Open Enigman2011 opened this issue 6 years ago • 3 comments

How can I use Blender Instead of Autodesk Maya?

Enigman2011 avatar Feb 19 '19 19:02 Enigman2011

Stringless can't work out-of-the-box with Blender, but you could develop a script, Blender Add-on, or feature within the Blender binary to read from the shared memory that the Stringless server writes to, similar to how the Reader class functions.

The Stringless code right now writes its captured facial data to the /stringless shared memory name (see Stringless.cc, lines 145 & 280), so any reader you implement can read from that name, as long as you're properly using the Mutex class (example) to ensure you don't run into the readers-writers problem.

justint avatar Feb 26 '19 07:02 justint

@Enigman2011 were you able to write it for Blender?

royaljain avatar Mar 29 '19 14:03 royaljain

Revisiting this now, I figure having a clear outline of how the Stringless Reader works would be helpful:


https://github.com/justint/stringless/blob/master/stringless-maya/src/StringlessMayaDevice.cc#L92

Above is the Maya plug-in code to read the data written out by the Stringless server.

An implementation of Stringless in another application (Blender, etc) could be done by following the steps outlined in the function linked above (StringlessMayaDevice::threadHandler()):

  1. Construct a Stringless::MemoryManager and point it to the shared memory address the server is writing to (by default: "/stringless"):
const std::string shared_memory_name = "/stringless";
// Set shared memory size to two frames
const size_t shared_memory_size = sizeof(struct Stringless::FrameData) * 2;

 memoryManager = Stringless::MemoryManager(shared_memory_name,
                                           shared_memory_size,
                                           Stringless::MemoryManager::read);
  1. Construct a Stringless::Reader to read from the MemoryManager's address:
reader = Stringless::Reader((Stringless::FrameData*)memoryManager.address());
  1. Read the FrameData from the Reader:
curFrameData = reader.read();

And there you have it!

justint avatar Aug 22 '20 20:08 justint