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

Autodesk/ppt/refactoring sandbox to dev 00 #154

Merged
merged 8 commits into from
Jan 14, 2020
Merged
2 changes: 2 additions & 0 deletions plugin/al/lib/AL_USDMaya/AL/usdmaya/CodeTimings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ void Profiler::popTime()
timespec endtime;
#ifdef _WIN32
while(clock_gettime(CLOCK_REALTIME_COARSE, &endtime) != 0) /* deliberately empty */;
#else
timespec_get(&endtime, TIME_UTC);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixes endtime uninitialized warning.

#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why this is changed?

// compute time difference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,14 @@ void AnimationTranslator::exportAnimation(const ExporterParams& params)
for(auto it = startWSM; it != endWSM; ++it)
{
MMatrix mat = it->first.inclusiveMatrix();
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
it->second.Set(*(const GfMatrix4d*)&mat, timeCode);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/al/lib/AL_USDMaya/AL/usdmaya/fileio/Import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void Import::doImport()
if(!status) status.perror("Failed to access instance parent");

// add each child from the instance transform, to the new transform
for(int i = 0; i < fnInstance.childCount(); ++i)
for(int i = 0; unsigned(i) < fnInstance.childCount(); ++i)
{
MObject child = fnInstance.child(i);
status = fnParent.addChild(child, MFnDagNode::kNextPos, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,14 @@ MStatus TransformTranslator::copyAttributes(const MObject& from, UsdPrim& to, co
{
MMatrix wsm = path.inclusiveMatrix();
auto op = xformSchema.AddTransformOp(UsdGeomXformOp::PrecisionDouble, TfToken("transform"));
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
op.Set(*(const GfMatrix4d*)&wsm, params.m_timeCode);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
if(animTranslator) animTranslator->addWorldSpace(path, op.GetAttr());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,6 @@ void TranslatorContext::removeItems(const SdfPath& path)
MDagModifier modifier2;
MObjectHandleArray tempXforms;
MStatus status;
bool hasDagNodes = false;
bool hasDependNodes = false;

// Store the DAG nodes to delete in a vector which we will sort via their path length
std::vector<std::pair<int, MObject>> dagNodesToDelete;
Expand Down Expand Up @@ -539,7 +537,7 @@ void TranslatorContext::removeEntries(const SdfPathVector& itemsToRemove)
//----------------------------------------------------------------------------------------------------------------------
void TranslatorContext::preUnloadPrim(UsdPrim& prim, const MObject& primObj)
{
TF_DEBUG(ALUSDMAYA_TRANSLATORS).Msg("TranslatorContext::preUnloadPrim %s");
TF_DEBUG(ALUSDMAYA_TRANSLATORS).Msg("TranslatorContext::preUnloadPrim %s", prim.GetPath().GetText());
assert(m_proxyShape);
auto stage = m_proxyShape->getUsdStage();
if(stage)
Expand Down
3 changes: 3 additions & 0 deletions plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ void ProxyShapeUI::getDrawRequests(const MDrawInfo& drawInfo, bool isObjectAndAc

MDrawRequest request = drawInfo.getPrototype(*this);

// If there are no side effects to calling surfaceShape(), the following two
// lines can be removed, as they are unused. PPT, 8-Jan-2020.
ProxyShape* shape = static_cast<ProxyShape*>(surfaceShape());
(void) shape;

// add the request to the queue
requests.add(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool PluginTranslatorOptionsContext::isRegistered(const char* const pluginTransl
//----------------------------------------------------------------------------------------------------------------------
AL_MAYA_UTILS_PUBLIC
PluginTranslatorOptions::PluginTranslatorOptions(PluginTranslatorOptionsContext& context, const char* const pluginTranslatorGrouping)
: m_options(), m_context(context), m_grouping(pluginTranslatorGrouping)
: m_grouping(pluginTranslatorGrouping), m_options(), m_context(context)
{
context.registerPluginTranslatorOptions(this);
}
Expand Down
62 changes: 31 additions & 31 deletions plugin/al/plugin/AL_USDMayaTestPlugin/AL/maya/test_EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,28 @@ TEST(Callback, Callback)

EXPECT_EQ(info1.tag(), "tag");
EXPECT_EQ(info1.callbackId(), makeCallbackId(1, 5, 3));
EXPECT_EQ(info1.eventId(), 1);
EXPECT_EQ(info1.eventId(), 1u);
EXPECT_TRUE(info1 < info2);
EXPECT_FALSE(info2 < info1);
EXPECT_TRUE(info1.userData() == &value);
EXPECT_TRUE(info1.callback() == func);
EXPECT_TRUE(info1.isCCallback());
EXPECT_FALSE(info1.isMELCallback());
EXPECT_FALSE(info1.isPythonCallback());
EXPECT_EQ(info1.weight(), 1000);
EXPECT_EQ(info1.weight(), 1000u);

// test python command
Callback info3("tag", "i am a command" , 1000, true, makeCallbackId(1, 5, 3));

EXPECT_EQ(info3.tag(), "tag");
EXPECT_EQ(info3.callbackId(), makeCallbackId(1, 5, 3));
EXPECT_EQ(info3.eventId(), 1);
EXPECT_EQ(info3.eventId(), 1u);
EXPECT_TRUE(info3.userData() == nullptr);
EXPECT_EQ(strcmp(info3.callbackText(), "i am a command"), 0);
EXPECT_FALSE(info3.isCCallback());
EXPECT_FALSE(info3.isMELCallback());
EXPECT_TRUE(info3.isPythonCallback());
EXPECT_EQ(info3.weight(), 1000);
EXPECT_EQ(info3.weight(), 1000u);

// test MEL command
Callback info4("tag", "i am a command" , 1000, false, makeCallbackId(1, 5, 3));
Expand All @@ -125,8 +125,8 @@ TEST(EventDispatcher, EventDispatcher)
int associated;
EventDispatcher info(&g_eventSystem, "eventName", 42, kUserSpecifiedEventType, &associated, 23);
EXPECT_EQ(info.name(), "eventName");
EXPECT_EQ(info.eventId(), 42);
EXPECT_EQ(info.parentCallbackId(), 23);
EXPECT_EQ(info.eventId(), 42u);
EXPECT_EQ(info.parentCallbackId(), 23u);
EXPECT_EQ(info.associatedData(), &associated);


Expand All @@ -138,7 +138,7 @@ TEST(EventDispatcher, EventDispatcher)
EXPECT_EQ(eventPart, 42);
uint64_t callbackPart = extractCallbackId(id1);

EXPECT_EQ(callbackPart, 1);
EXPECT_EQ(callbackPart, 1u);

ASSERT_FALSE(info.callbacks().empty());
const Callback& callback = info.callbacks()[0];
Expand All @@ -150,15 +150,15 @@ TEST(EventDispatcher, EventDispatcher)
EXPECT_TRUE(callback.isCCallback());
EXPECT_FALSE(callback.isMELCallback());
EXPECT_FALSE(callback.isPythonCallback());
EXPECT_EQ(callback.weight(), 1001);
EXPECT_EQ(callback.weight(), 1001u);
}

CallbackId id2 = info.registerCallback("tag2", "i am a command", 1003, false);

{
uint64_t callbackPart = extractCallbackId(id2);

EXPECT_EQ(callbackPart, 2);
EXPECT_EQ(callbackPart, 2u);

ASSERT_TRUE(info.callbacks().size() == 2);
const Callback& callback = info.callbacks()[1];
Expand All @@ -170,17 +170,17 @@ TEST(EventDispatcher, EventDispatcher)
EXPECT_FALSE(callback.isCCallback());
EXPECT_TRUE(callback.isMELCallback());
EXPECT_FALSE(callback.isPythonCallback());
EXPECT_EQ(callback.weight(), 1003);
EXPECT_EQ(callback.weight(), 1003u);
}

CallbackId id3 = info.registerCallback("tag3", "i am a command", 1002, true);

{
uint64_t callbackPart = extractCallbackId(id3);

EXPECT_EQ(callbackPart, 3);
EXPECT_EQ(callbackPart, 3u);

ASSERT_TRUE(info.callbacks().size() == 3);
ASSERT_TRUE(info.callbacks().size() == 3u);
const Callback& callback = info.callbacks()[1];

EXPECT_EQ(callback.callbackId(), id3);
Expand All @@ -190,33 +190,33 @@ TEST(EventDispatcher, EventDispatcher)
EXPECT_FALSE(callback.isCCallback());
EXPECT_FALSE(callback.isMELCallback());
EXPECT_TRUE(callback.isPythonCallback());
EXPECT_EQ(callback.weight(), 1002);
EXPECT_EQ(callback.weight(), 1002u);
}

EventDispatcher info2(std::move(info));
EXPECT_TRUE(info2.name() == "eventName");
EXPECT_TRUE(info2.callbacks().size() == 3);
EXPECT_TRUE(info2.callbacks().size() == 3u);
EXPECT_EQ(info2.associatedData(), &associated);
EXPECT_TRUE(info.name().empty());
EXPECT_TRUE(info.callbacks().empty());

info = std::move(info2);
EXPECT_EQ(info.associatedData(), &associated);
EXPECT_TRUE(info.name() == "eventName");
EXPECT_TRUE(info.callbacks().size() == 3);
EXPECT_TRUE(info.callbacks().size() == 3u);
EXPECT_TRUE(info2.name().empty());
EXPECT_TRUE(info2.callbacks().empty());

// dont unregister an invalid event
EXPECT_FALSE(info.unregisterCallback(488));

EXPECT_TRUE(info.unregisterCallback(id1));
ASSERT_TRUE(info.callbacks().size() == 2);
ASSERT_TRUE(info.callbacks().size() == 2u);
ASSERT_TRUE(info.callbacks()[0].callbackId() == id3);
ASSERT_TRUE(info.callbacks()[1].callbackId() == id2);

EXPECT_TRUE(info.unregisterCallback(id2));
ASSERT_TRUE(info.callbacks().size() == 1);
ASSERT_TRUE(info.callbacks().size() == 1u);
ASSERT_TRUE(info.callbacks()[0].callbackId() == id3);

EXPECT_TRUE(info.unregisterCallback(id3));
Expand Down Expand Up @@ -293,22 +293,22 @@ TEST(EventScheduler, registerEvent)
EXPECT_TRUE(id1 != 0);
auto eventInfo = registrar.event(id1);
EXPECT_TRUE(eventInfo != nullptr);
EXPECT_EQ(eventInfo->eventId(), 1);
EXPECT_EQ(eventInfo->parentCallbackId(), 0);
EXPECT_EQ(eventInfo->eventId(), 1u);
EXPECT_EQ(eventInfo->parentCallbackId(), 0u);
EXPECT_EQ(eventInfo->associatedData(), &associated);

// This should fail to register a new event (since the name is not unique)
EventId id2 = registrar.registerEvent("eventName", kUserSpecifiedEventType, &associated, 0);
EXPECT_EQ(id2, 0);
EXPECT_EQ(id2, 0u);

// We should be able to register a new event (since the associated data is different)
int associated2;
EventId id3 = registrar.registerEvent("eventName", kUserSpecifiedEventType, &associated2, 0);
EXPECT_TRUE(id3 != 0);
eventInfo = registrar.event(id3);
EXPECT_TRUE(eventInfo != nullptr);
EXPECT_EQ(eventInfo->eventId(), 2);
EXPECT_EQ(eventInfo->parentCallbackId(), 0);
EXPECT_EQ(eventInfo->eventId(), 2u);
EXPECT_EQ(eventInfo->parentCallbackId(), 0u);
EXPECT_EQ(eventInfo->associatedData(), &associated2);

EXPECT_TRUE(registrar.unregisterEvent(id1));
Expand All @@ -332,8 +332,8 @@ TEST(EventScheduler, registerChildEvent)
EXPECT_TRUE(id1 != 0);
auto parentEventInfo = registrar.event(id1);
EXPECT_TRUE(parentEventInfo != nullptr);
EXPECT_EQ(parentEventInfo->eventId(), 1);
EXPECT_EQ(parentEventInfo->parentCallbackId(), 0);
EXPECT_EQ(parentEventInfo->eventId(), 1u);
EXPECT_EQ(parentEventInfo->parentCallbackId(), 0u);
EXPECT_EQ(parentEventInfo->associatedData(), &associated);

int value;
Expand All @@ -343,7 +343,7 @@ TEST(EventScheduler, registerChildEvent)
EXPECT_TRUE(id2 != 0);
auto eventInfo = registrar.event(id2);
EXPECT_TRUE(eventInfo != nullptr);
EXPECT_EQ(eventInfo->eventId(), 2);
EXPECT_EQ(eventInfo->eventId(), 2u);
EXPECT_EQ(eventInfo->parentCallbackId(), callbackId);
EXPECT_EQ(eventInfo->associatedData(), &associated);

Expand Down Expand Up @@ -374,8 +374,8 @@ TEST(EventScheduler, registerCallback)
EXPECT_TRUE(id1 != 0);
auto parentEventInfo = registrar.event(id1);
EXPECT_TRUE(parentEventInfo != nullptr);
EXPECT_EQ(parentEventInfo->eventId(), 1);
EXPECT_EQ(parentEventInfo->parentCallbackId(), 0);
EXPECT_EQ(parentEventInfo->eventId(), 1u);
EXPECT_EQ(parentEventInfo->parentCallbackId(), 0u);
EXPECT_EQ(parentEventInfo->associatedData(), &associated);

int value;
Expand All @@ -385,7 +385,7 @@ TEST(EventScheduler, registerCallback)
EXPECT_TRUE(id2 != 0);
auto eventInfo = registrar.event(id2);
EXPECT_TRUE(eventInfo != nullptr);
EXPECT_EQ(eventInfo->eventId(), 2);
EXPECT_EQ(eventInfo->eventId(), 2u);
EXPECT_EQ(eventInfo->parentCallbackId(), callbackId);
EXPECT_EQ(eventInfo->associatedData(), &associated);

Expand Down Expand Up @@ -426,15 +426,15 @@ TEST(EventScheduler, registerCallbackAgainstEventThatDoesNotExist)
EXPECT_TRUE(id1 != 0);
auto eventInfo = registrar.event(id1);
EXPECT_TRUE(eventInfo != nullptr);
EXPECT_EQ(eventInfo->eventId(), 1);
EXPECT_EQ(eventInfo->parentCallbackId(), 0);
EXPECT_EQ(eventInfo->eventId(), 1u);
EXPECT_EQ(eventInfo->parentCallbackId(), 0u);
EXPECT_EQ(eventInfo->associatedData(), &associated);

CallbackId callbackId = registrar.registerCallback(id1, "ChildCallback2", func_dispatch2, 1000, &value);

EXPECT_TRUE(registrar.unregisterCallback(cb.callbackId()));
eventInfo = registrar.event(id1);
EXPECT_EQ(1, eventInfo->callbacks().size());
EXPECT_EQ(1u, eventInfo->callbacks().size());

EXPECT_TRUE(registrar.unregisterCallback(callbackId));
eventInfo = registrar.event(id1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEST(maya_Event, registerEvent)
EXPECT_EQ(std::string(""), std::string(callbackInfo->callbackText()));
EXPECT_EQ(std::string("I'm a tag"), std::string(callbackInfo->tag()));
EXPECT_EQ(callback, callbackInfo->callbackId());
EXPECT_EQ(1234, callbackInfo->weight());
EXPECT_EQ(1234u, callbackInfo->weight());
EXPECT_FALSE(callbackInfo->isPythonCallback());
EXPECT_FALSE(callbackInfo->isMELCallback());
EXPECT_TRUE(callbackInfo->isCCallback());
Expand Down Expand Up @@ -96,7 +96,7 @@ TEST(maya_Event, invalidRegisteredEvent)
1234,
0);

EXPECT_EQ(id, 0);
EXPECT_EQ(id, 0u);
}

//----------------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ TEST(ExportCommands, extensiveAnimationCheck)
for(auto op : ops)
{
auto attr = op.GetAttr();
EXPECT_EQ(10, attr.GetNumTimeSamples());
EXPECT_EQ(10u, attr.GetNumTimeSamples());
}
}
else
Expand Down
Loading