Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Blender instead of Maya #9

Open
Enigman2011 opened this issue Feb 19, 2019 · 3 comments
Open

Using Blender instead of Maya #9

Enigman2011 opened this issue Feb 19, 2019 · 3 comments

Comments

@Enigman2011
Copy link

How can I use Blender Instead of Autodesk Maya?

@justint
Copy link
Owner

justint commented Feb 26, 2019

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.

@royaljain
Copy link

@Enigman2011 were you able to write it for Blender?

@justint
Copy link
Owner

justint commented Aug 22, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants