Copy link to clipboard
Copied
Hey all-- Wanted to share a project I've been working on, mainly in hopes that others end up contributing, as its open source!
Trentonom0r3/AETK: A modern C++ framework designed to revolutionize the way developers create plugin...
I have a few sample projects made, including a recreation of the Grabba sample, showing an easier way to go about setting things up!
#include <AETK/AEGP/AEGP.hpp>
static A_long S_idle_count = 0L;
class GrabbaCommand : public Command {
public:
GrabbaCommand() : Command("Grabba", MenuID::EXPORT) {}
inline void execute() override;
inline void updateMenu() override;
};
class Grabba : public Plugin {
public:
Grabba(struct SPBasicSuite* pica_basicP,
AEGP_PluginID aegp_plugin_id,
AEGP_GlobalRefcon* global_refconV)
: Plugin(pica_basicP, aegp_plugin_id, global_refconV)
{
}
inline void onInit();
void onDeath();
void onIdle();
};
#include "Grabba.h"
#include "windows.h"
AEGP_PluginID myID = 3927L;
void GrabbaCommand::execute() {
try {
auto item = ItemSuite().GetActiveItem();
RenderOptionsPtr& renderOptions = RenderOptionsSuite().newFromItem(item);
RenderOptionsSuite().setTime(renderOptions, ItemSuite().GetItemCurrentTime(item));
auto frameReceipt = RenderSuite().renderAndCheckoutFrame(renderOptions);
auto world = RenderSuite().getReceiptWorld(frameReceipt);
void* mainhwnd = UtilitySuite().getMainHWND();
OPENFILENAME ofn;
char szFile[100];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = HWND(mainhwnd);
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
GetSaveFileName(&ofn);
//image->saveImage(ofn.lpstrFile, "png");
if (ofn.lpstrFile[0] != '\0') {
auto data = Image::data(world);
Image::saveImage(ofn.lpstrFile, "png", data);
}
}
catch (const std::exception& e) {
App::Alert(e.what());
}
catch (...) {
App::Alert("An unknown error occurred.");
}
}
void GrabbaCommand::updateMenu() {
auto activeItem = ItemSuite().GetActiveItem();
if (!activeItem.get()) {
enableCommand(false);
return;
}
ItemType itemType = ItemSuite().GetItemType(activeItem);
bool enable = activeItem.get() && (itemType == ItemType::FOOTAGE || itemType == ItemType::COMP);
enableCommand(enable);
}
void Grabba::onInit()
{
addCommand(std::make_unique<GrabbaCommand>());
registerCommandHook();
registerUpdateMenuHook();
}
void Grabba::onDeath()
{
}
void Grabba::onIdle()
{
}
DECLARE_ENTRY(Grabba, myID)
Copy link to clipboard
Copied
Dude! you're crushing it! way to go!
Copy link to clipboard
Copied
Thank you Shachar!!!
That means a lot coming from you!
You've been a lot of help along the way, believe it or not!
Copy link to clipboard
Copied
awwww! ❤️