Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Simpliying the AE SDK

Explorer ,
Apr 09, 2024 Apr 09, 2024

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)

 

TOPICS
Resources , SDK
521
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2024 Apr 10, 2024

Dude! you're crushing it! way to go!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 11, 2024 Apr 11, 2024

Thank you Shachar!!! 
That means a lot coming from you!
You've been a lot of help along the way, believe it or not!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 11, 2024 Apr 11, 2024
LATEST

awwww! ❤️

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines