Skip to content

Commit

Permalink
update dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Trentonom0r3 committed Feb 5, 2024
1 parent 2e9d1d9 commit a30dff8
Show file tree
Hide file tree
Showing 88 changed files with 11,832 additions and 3,152 deletions.
1 change: 0 additions & 1 deletion AEvolution/AEvolutionPlugin/AEvolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
//SDK HEADERS
#include "entry.h"
#include "AE_GeneralPlug.h"
#include "AE_Macros.h"
#include "AEGP_SuiteHandler.h"
#include "AE_Macros.h"
#include "CoreSDK/SuiteManager.h"
Expand Down
23 changes: 17 additions & 6 deletions AEvolution/AEvolutionPlugin/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -1567,11 +1567,11 @@ class getProjectCommand : public CommandBase {
};
void execute() override;
};
class ExecuteCommandCommand : public CommandBase {
class executecmdCommand : public CommandBase {
public:
ExecuteCommandCommand() = default;
executecmdCommand() = default;

ExecuteCommandCommand(Command cmd) : CommandBase(cmd) {
executecmdCommand(Command cmd) : CommandBase(cmd) {

};
void execute() override;
Expand Down Expand Up @@ -1804,6 +1804,16 @@ class ReportInfoCommand : public CommandBase {
void execute() override;
};

class getItemNameCommand : public CommandBase {
public:
getItemNameCommand() = default;

getItemNameCommand(Command cmd) : CommandBase(cmd) {

};
void execute() override;
};

class CommandFactory {
public:
CommandFactory() {
Expand All @@ -1815,13 +1825,14 @@ class CommandFactory {
commands["CollectionPushBack"] = [](const Command& cmd) { return std::make_unique<CollectionPushBackCommand>(cmd); };
commands["CollectionErase"] = [](const Command& cmd) { return std::make_unique<CollectionEraseCommand>(cmd); };
commands["Addcomp"] = [](const Command& cmd) { return std::make_unique<AddcompCommand>(cmd); };
commands["getCompFromItem"] = [](const Command& cmd) { return std::make_unique<getCompFromItemCommand>(cmd); };
commands["GetCompFromItem"] = [](const Command& cmd) { return std::make_unique<getCompFromItemCommand>(cmd); };
commands["GetItemFromComp"] = [](const Command& cmd) { return std::make_unique<GetItemFromCompCommand>(cmd); };
commands["GetCompDownsampleFactor"] = [](const Command& cmd) { return std::make_unique<GetCompDownsampleFactorCommand>(cmd); };
commands["SetCompDownsampleFactor"] = [](const Command& cmd) { return std::make_unique<SetCompDownsampleFactorCommand>(cmd); };
commands["GetCompBGColor"] = [](const Command& cmd) { return std::make_unique<GetCompBGColorCommand>(cmd); };
commands["SetCompBGColor"] = [](const Command& cmd) { return std::make_unique<SetCompBGColorCommand>(cmd); };
commands["GetCompFlags"] = [](const Command& cmd) { return std::make_unique<GetCompFlagsCommand>(cmd); };
commands["getItemName"] = [](const Command& cmd) { return std::make_unique<getItemNameCommand>(cmd); };
commands["GetShowLayerNameOrSourceName"] = [](const Command& cmd) { return std::make_unique<GetShowLayerNameOrSourceNameCommand>(cmd); };
commands["SetShowLayerNameOrSourceName"] = [](const Command& cmd) { return std::make_unique<SetShowLayerNameOrSourceNameCommand>(cmd); };
commands["GetShowBlendModes"] = [](const Command& cmd) { return std::make_unique<GetShowBlendModesCommand>(cmd); };
Expand Down Expand Up @@ -1981,7 +1992,7 @@ class CommandFactory {
commands["togglePanelVisibility"] = [](const Command& cmd) { return std::make_unique<togglePanelVisibilityCommand>(cmd); };
commands["isPanelShown"] = [](const Command& cmd) { return std::make_unique<isPanelShownCommand>(cmd); };
commands["getProject"] = [](const Command& cmd) { return std::make_unique<getProjectCommand>(cmd); };
commands["ExecuteCommand"] = [](const Command& cmd) { return std::make_unique<ExecuteCommandCommand>(cmd); };
commands["executeCommand"] = [](const Command& cmd) { return std::make_unique<executecmdCommand>(cmd); };
commands["GetProjectName"] = [](const Command& cmd) { return std::make_unique<GetProjectNameCommand>(cmd); };
commands["GetProjectPath"] = [](const Command& cmd) { return std::make_unique<GetProjectPathCommand>(cmd); };
commands["SaveProjectToPath"] = [](const Command& cmd) { return std::make_unique<SaveProjectToPathCommand>(cmd); };
Expand All @@ -2006,7 +2017,7 @@ class CommandFactory {
commands["getPluginPaths"] = [](const Command& cmd) { return std::make_unique<getPluginPathsCommand>(cmd); };
commands["getBaseAddr8"] = [](const Command& cmd) { return std::make_unique<getBaseAddr8Command>(cmd); };
commands["getSize"] = [](const Command& cmd) { return std::make_unique<getSizeCommand>(cmd); };
commands["reportInfo"] = [](const Command& cmd) { return std::make_unique<ReportInfoCommand>(cmd); };
commands["ReportInfo"] = [](const Command& cmd) { return std::make_unique<ReportInfoCommand>(cmd); };
//
}

Expand Down
97 changes: 66 additions & 31 deletions AEvolution/AEvolutionPlugin/CoreLib/CoreUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,57 +94,61 @@ class LayerH : public BaseH {
class Collection2H : public BaseH {
public:
Collection2H() {}
Collection2H(std::string sessionID) : BaseH(sessionID) {}
Collection2H(std::string sessionID) : BaseH(sessionID) {}

private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
}
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
}
};

class CollectionItemH : public BaseH {
public:
public:
CollectionItemH() {}
CollectionItemH(std::string sessionID) : BaseH(sessionID) {}

CollectionItemH(std::string sessionID) : BaseH(sessionID) {}
std::string type = "";
std::string typeSessionID = "";
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
}
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
ar& type;
ar& typeSessionID;
}
};


class StreamRefH : public BaseH {
public:
StreamRefH() {}
StreamRefH(std::string sessionID) : BaseH(sessionID) {}
StreamRefH(std::string sessionID) : BaseH(sessionID) {}

private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
}
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
}
};

class EffectRefH : public BaseH {
public:
EffectRefH() {}
EffectRefH(std::string sessionID) : BaseH(sessionID) {}
EffectRefH(std::string sessionID) : BaseH(sessionID) {}

private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
}
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& boost::serialization::base_object<BaseH>(*this);
}
};

class FootageH : public BaseH {
Expand All @@ -159,4 +163,35 @@ class FootageH : public BaseH {
{
ar& boost::serialization::base_object<BaseH>(*this);
}
};
};

struct dimensionsH {
int width = 0;
int height = 0;
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& width;
ar& height;
}
};

struct colorH {
float r = 0;
float g = 0;
float b = 0;
float a = 0;

private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int version)
{
ar& r;
ar& g;
ar& b;
ar& a;
}
};
10 changes: 5 additions & 5 deletions AEvolution/AEvolutionPlugin/CoreSDK/CollectionSuites.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ AEGP_EffectRefHs, on the other hand, are not adopted, and must be freed by the c

Result<AEGP_Collection2H> NewCollection();

Result<void> DisposeCollection(AEGP_Collection2H collectionH);
Result<void> DisposeCollection(Result<AEGP_Collection2H> collectionH);

Result<int> GetCollectionNumItems(AEGP_Collection2H collectionH);
Result<int> GetCollectionNumItems(Result<AEGP_Collection2H> collectionH);

Result<AEGP_CollectionItemV2> GetCollectionItemByIndex( AEGP_Collection2H collectionH, int indexL);
Result<AEGP_CollectionItemV2> GetCollectionItemByIndex(Result<AEGP_Collection2H> collectionH, int indexL);

Result<void> CollectionPushBack( AEGP_Collection2H collectionH, const AEGP_CollectionItemV2* itemP);
Result<void> CollectionPushBack(Result<AEGP_Collection2H> collectionH, const AEGP_CollectionItemV2* itemP);

Result<void> CollectionErase( AEGP_Collection2H collectionH, int index_firstL, int index_lastL);
Result<void> CollectionErase(Result<AEGP_Collection2H> collectionH, int index_firstL, int index_lastL);

45 changes: 45 additions & 0 deletions AEvolution/AEvolutionPlugin/CoreSDK/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,51 @@
#include <mutex>
#include <boost/locale/encoding_utf.hpp>

// Custom Exception class
class AEException : public std::exception {
public:
// Constructor
AEException(A_long errorCode)
: errorCode_(errorCode), errorMessage_(ErrToString(errorCode)) {}

// Default virtual destructor
virtual ~AEException() noexcept {}

// Override the what() function to provide a custom error message
virtual const char* what() const noexcept override {
return errorMessage_.c_str();
}

// Function to convert error code to string
// You can expand this function to return more detailed messages based on errorCode_
static std::string ErrToString(A_long errorCode) {
switch (errorCode) {
case A_Err_NONE: return "";
case A_Err_GENERIC: return "Generic error";
case A_Err_STRUCT: return "Structural error";
case A_Err_PARAMETER: return "Parameter error";
case A_Err_ALLOC: return "Allocation error";
case A_Err_WRONG_THREAD: return "Wrong thread error";
case A_Err_CONST_PROJECT_MODIFICATION: return "Constant project modification error";
case A_Err_MISSING_SUITE: return "Missing suite error";
case A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING: return "Not in cache or compute pending error";
case A_Err_PROJECT_LOAD_FATAL: return "Project load fatal error";
case A_Err_EFFECT_APPLY_FATAL: return "Effect apply fatal error";
// Add more cases as needed
default: return "Unknown error";
}
}

// Getter for the error code
A_long ErrorCode() const {
return errorCode_;
}

private:
A_long errorCode_;
std::string errorMessage_;
};


/*
* File: Core.h
Expand Down
28 changes: 18 additions & 10 deletions AEvolution/AEvolutionPlugin/CoreSDK/ItemSuites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ Result<AEGP_ItemH> getActiveItem()
AEGP_SuiteHandler& suites = SuiteManager::GetInstance().GetSuiteHandler();
A_Err err = A_Err_NONE;
AEGP_ItemH itemH; // Initialize to nullptr in case AEGP_GetActiveItem fails
Result<AEGP_ItemH> result;

ERR(suites.ItemSuite9()->AEGP_GetActiveItem(&itemH));

Result<AEGP_ItemH> result;
if (err != A_Err_NONE) {
if (itemH == NULL) {
result.value = nullptr;
throw std::runtime_error("Error getting active item. Error code: " + std::to_string(err));
result.error = A_Err_ALLOC;
return result;
}
else {
result.value = itemH;
if (err != A_Err_NONE) {
result.value = nullptr;
result.error = err;
return result;
}

result.value = itemH;
result.error = err; // Set the error

return result;
Expand All @@ -29,14 +35,16 @@ Result<AEGP_ItemType> getItemType(Result<AEGP_ItemH> item)
A_Err err = A_Err_NONE;
AEGP_ItemType item_type = AEGP_ItemType_NONE; // Initialize to AEGP_ItemType_NONE in case AEGP_GetItemType fails
AEGP_ItemH itemH = item.value;
if (!itemH) {
throw A_Err_STRUCT; // throw an error if item is null
}
Result<AEGP_ItemType> result;

ERR(suites.ItemSuite9()->AEGP_GetItemType(itemH, &item_type));

if (err != A_Err_NONE) {
throw std::runtime_error("Error getting item type. Error code: " + std::to_string(err));
result.value = AEGP_ItemType_NONE;
result.error = err;
return result;
}
Result<AEGP_ItemType> result;

result.value = item_type; // Set the value to the item type
result.error = err; // Set the error

Expand Down
1 change: 1 addition & 0 deletions AEvolution/AEvolutionPlugin/CoreSDK/SuiteManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "AEGP_SuiteHandler.h"
#include "AE_GeneralPlugPanels.h"
#include "AE_GeneralPlug.h"
#include "SuiteHelper.h"
/*
* File: SuiteManager.h
Expand Down
1 change: 1 addition & 0 deletions AEvolution/AEvolutionPlugin/Library.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Library.h"

//
std::string errToString(A_Err err) {
switch (err) {
case A_Err_NONE:
Expand Down
3 changes: 2 additions & 1 deletion AEvolution/AEvolutionPlugin/PyUtils/MessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
std::string createUUID();

typedef boost::variant<int, float, std::string, bool, std::vector<std::string>, boost::shared_ptr<ItemH>,
boost::shared_ptr<CompH>, boost::shared_ptr<LayerH>, boost::shared_ptr<ProjectH>> CommandArg;
boost::shared_ptr<CompH>, boost::shared_ptr<LayerH>, boost::shared_ptr<ProjectH>, boost::shared_ptr<StreamRefH>, dimensionsH, colorH> CommandArg;

typedef std::vector<CommandArg> CommandArgs;

Expand Down Expand Up @@ -65,6 +65,7 @@ struct Response {
void serialize(Archive& ar, const unsigned int version) {
ar& sessionID;
ar& args;
ar& error;
}
}; // Response to be sent to the client

Expand Down
Loading

0 comments on commit a30dff8

Please sign in to comment.