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

Add support for pure-binary grease pencil line art files #248

Closed
wants to merge 15 commits into from

Conversation

DJLevel3
Copy link
Contributor

Pretty much as described in the title, this improves line-art loading and parsing performance immensely at the expense of making the files non-human-readable (though they were pretty unreadable before, lmao) and deprecates the JSON format (though preserving the format's useability).

@DJLevel3
Copy link
Contributor Author

This PR also adds support for Blender 4.2+ via a second, identical version of the Blender addon that has the proper blender_manifest.toml alongside the script.

}

// Codes: 0 - Parsing failed | 1 - No frames read | 2 - No valid frames
void BinaryLineArtParser::parsingFailed(int code) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing an implementation - please could you also change code to be an enum so that it's more readable?

auto json = juce::JSON::parse(message.get());

juce::Array<juce::var> objects = *json.getProperty("objects", juce::Array<juce::var>()).getArray();
double focalLength = json.getProperty("focalLength", 1);

std::vector<Line> frameContainer = LineArtParser::generateFrame(objects, focalLength);
std::vector<Line> frameContainer = BinaryLineArtParser::generateJsonFrame(objects, focalLength);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much work would it be to change this over to the binary format instead of sending json? I imagine it would lead to a big performance improvement when live-sending frames from Blender

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

james to check whether this can be made into just a single file

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DJLevel3 it works fine if you install a single zip file on both versions where:

zip contains blender_manifest.toml with Blender 4.2 minimum
__init__.py contains bl_info with Blender 3.1.2 minimum

I tested on both 3.1.2 and 4.2 and the same zip file worked for both, so we should be good to make those changes and collapse it into a single file, and it also means we only need to distribute a single plugin which is a nice bonus.

@DJLevel3
Copy link
Contributor Author

I'll have to redo these changes as they're not compatible with the LuaJIT changes in #259. Closing for now, I'll get back to it once things are finalized with LuaJIT.

@DJLevel3 DJLevel3 closed this Sep 30, 2024
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

Successfully merging this pull request may close these issues.

2 participants