@m_magalhaes
Hi m_magalhaes - The goal is to time how long it takes to do all the draw calls inside ZoomInOut
.
Yes Bool GUI::CoreMessage(Int32 id, const BaseContainer &bc)
in in main.cpp
I added to the code to show there is a button in GUI::CreateLayout()
that calls GUI::Command(Int32 id, const BaseContainer &msg)
which then calls ZoomInOut
I have to call ZoomInOut
from the main C4D thread because DrawViews
can only be called by the main thread. I think that is how i understand the documentation.
/////main.cpp/////
TestClass testClassInstance = TestClass();
Bool GUI::CoreMessage(Int32 id, const BaseContainer &bc)
{
switch (id)
{
case CUSTOMEVENT::UPDATE_UI_DIALOG:
{
SetString(DLG_DYNAMIC_RENDER_TEXT, "test changed text"_s);
}
}
}
bool GUI::CreateLayout()
{
AddStaticText(DLG_DYNAMIC_RENDER_TEXT, BFH_LEFT, 250, 12, "initial text "_s, BORDER_NONE);
AddButton(RUN_TESTS, BFH_LEFT, 0, 0, "Run Test"_s);
return true;
}
bool GUI::Command(Int32 id, const BaseContainer &msg)
{
switch (id)
{
case RUN_TESTS:
{
testClassInstance.ZoomInOut();
}
}
}
////testclass.cpp////
void TestClass::ZoomInOut(int steps)
{
for (int i = 0; i < steps; i++)
{
CallCommand(14063);
DrawViews(DRAWFLAGS::ONLY_ACTIVE_VIEW | DRAWFLAGS::NO_THREAD | DRAWFLAGS::NO_REDUCTION | DRAWFLAGS::STATICBREAK);
}
//this message isnt caught until the for loop below it is completed, need it to be synchronous
SpecialEventAdd(CUSTOMEVENT::UPDATE_UI_DIALOG);
for (int i = 0; i < steps; i++)
{
CallCommand(14064);
DrawViews(DRAWFLAGS::ONLY_ACTIVE_VIEW | DRAWFLAGS::NO_THREAD | DRAWFLAGS::NO_REDUCTION | DRAWFLAGS::STATICBREAK);
}
}