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

Fill in missing export translator implementation #1728

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ class TranslatorBaseWrapper
{
MFnDependencyNode fn(obj);
std::string name(fn.name().asChar());
return this->CallVirtual<ExportFlag>("canExport", &This::canExport)(obj);

// pass a string to the python method instead of a dependency node
if (Override o = GetOverride("canExport")) {
return std::function<ExportFlag(const char*)>(TfPyCall<ExportFlag>(o))(name.c_str());
}
return ExportFlag::kNotSupported;
}

UsdPrim exportObject(
Expand All @@ -186,9 +191,20 @@ class TranslatorBaseWrapper
const SdfPath& usdPath,
const AL::usdmaya::fileio::ExporterParams& params) override
{
// note: an incomplete list, add as needed
boost::python::dict pyParams;
pyParams["dynamicAttributes"] = params.m_dynamicAttributes;
pyParams["m_minFrame"] = params.m_minFrame;
pyParams["m_maxFrame"] = params.m_maxFrame;

std::string name(dagPath.fullPathName().asChar());
return this->CallVirtual<UsdPrim>("exportObject", &This::exportObject)(
stage, dagPath, usdPath, params);
// pass a dagPath name and dictionary of params to the python method
if (Override o = GetOverride("exportObject")) {
return std::function<UsdPrim(
UsdStageRefPtr, const char*, SdfPath, boost::python::dict)>(TfPyCall<UsdPrim>(o))(
stage, name.c_str(), usdPath, pyParams);
}
return UsdPrim();
}

static void registerTranslator(refptr_t plugin, const TfToken& assetType = TfToken())
Expand Down