本文整理汇总了C++中MFileObject::setRawFullName方法的典型用法代码示例。如果您正苦于以下问题:C++ MFileObject::setRawFullName方法的具体用法?C++ MFileObject::setRawFullName怎么用?C++ MFileObject::setRawFullName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFileObject
的用法示例。
在下文中一共展示了MFileObject::setRawFullName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFilesToArchive
// returns the list of files to archive.
MStringArray AlembicNode::getFilesToArchive(
bool /* shortName */,
bool unresolvedName,
bool /* markCouldBeImageSequence */) const
{
MStringArray files;
MStatus status = MS::kSuccess;
MPlug fileNamePlug(thisMObject(), mAbcFileNameAttr);
MString fileName = fileNamePlug.asString(MDGContext::fsNormal, &status);
if (status == MS::kSuccess && fileName.length() > 0) {
if(unresolvedName)
{
files.append(fileName);
}
else
{
//unresolvedName is false, resolve the path via MFileObject.
MFileObject fileObject;
fileObject.setRawFullName(fileName);
files.append(fileObject.resolvedFullName());
}
}
return files;
}
示例2: getFilesToArchive
// returns the list of files to archive.
MStringArray AlembicNode::getFilesToArchive(
bool /* shortName */,
bool unresolvedName,
bool /* markCouldBeImageSequence */) const
{
MStringArray files;
MStatus status = MS::kSuccess;
MPlug layerFilenamesPlug(thisMObject(), mAbcLayerFileNamesAttr);
MFnStringArrayData fnSAD( layerFilenamesPlug.asMObject() );
MStringArray layerFilenames = fnSAD.array();
for( unsigned int i = 0; i < layerFilenames.length(); i++ )
{
MString fileName = layerFilenames[i];
if (status == MS::kSuccess && fileName.length() > 0) {
if(unresolvedName)
{
files.append(fileName);
}
else
{
//unresolvedName is false, resolve the path via MFileObject.
MFileObject fileObject;
fileObject.setRawFullName(fileName);
files.append(fileObject.resolvedFullName());
}
}
}
return files;
}
示例3: mayaCgLocation
void
cgfxGetFxIncludePath( const MString &fxFile, MStringArray &pathOptions )
{
// Append the path of the cgfx file as a possible include search path
//
MString option;
if (fxFile.length())
{
MFileObject fobject;
fobject.setRawFullName( fxFile );
option = MString("-I") + fobject.resolvedPath();
pathOptions.append( option );
}
// Add in "standard" cgfx search for cgfx files as a possible include
// search path
//
char * cgfxRoot = getenv("CGFX_ROOT");
if (cgfxRoot)
{
option = MString("-I") + MString(cgfxRoot);
pathOptions.append( option );
option = MString("-I") + MString(cgfxRoot) + MString("/CgFX");
pathOptions.append( option );
}
// Add in Maya's Cg directory
char * mayaLocation = getenv("MAYA_LOCATION");
if (mayaLocation)
{
MString mayaCgLocation(MString(mayaLocation) + MString("/bin/Cg/"));
option = MString("-I") + mayaCgLocation;
pathOptions.append( option );
}
}
示例4: doIt
//.........这里部分代码省略.........
status = argData.getCommandArgument(0, filename);
MString abcNodeName;
if (status == MS::kSuccess)
{
{
MString fileRule, expandName;
MString alembicFileRule = "alembicCache";
MString alembicFilePath = "cache/alembic";
MString queryFileRuleCmd;
queryFileRuleCmd.format("workspace -q -fre \"^1s\"",
alembicFileRule);
MString queryFolderCmd;
queryFolderCmd.format("workspace -en `workspace -q -fre \"^1s\"`",
alembicFileRule);
// query the file rule for alembic cache
MGlobal::executeCommand(queryFileRuleCmd, fileRule);
if (fileRule.length() > 0)
{
// we have alembic file rule, query the folder
MGlobal::executeCommand(queryFolderCmd, expandName);
}
// resolve the expanded file rule
if (expandName.length() == 0)
{
expandName = alembicFilePath;
}
// get the path to the alembic file rule
MFileObject directory;
directory.setRawFullName(expandName);
MString directoryName = directory.resolvedFullName();
// resolve the relative path
MFileObject absoluteFile;
absoluteFile.setRawFullName(filename);
absoluteFile.setResolveMethod(MFileObject::kInputFile);
#if MAYA_API_VERSION < 201300
if (absoluteFile.resolvedFullName() !=
absoluteFile.expandedFullName())
{
#else
if (!MFileObject::isAbsolutePath(filename)) {
#endif
// this is a relative path
MString absoluteFileName = directoryName + "/" + filename;
absoluteFile.setRawFullName(absoluteFileName);
filename = absoluteFile.resolvedFullName();
}
else
{
filename = absoluteFile.resolvedFullName();
}
}
MFileObject fileObj;
status = fileObj.setRawFullName(filename);
if (status == MS::kSuccess && fileObj.exists())
{
ArgData inputData(filename, debugOn, reparentObj,
swap, connectRootNodes, createIfNotFound, removeIfNoUpdate,
recreateColorSets, filterString, excludeFilterString);
abcNodeName = createScene(inputData);
示例5: compute
MStatus AlembicNode::compute(const MPlug & plug, MDataBlock & dataBlock)
{
MStatus status;
// update the frame number to be imported
MDataHandle speedHandle = dataBlock.inputValue(mSpeedAttr, &status);
double speed = speedHandle.asDouble();
MDataHandle offsetHandle = dataBlock.inputValue(mOffsetAttr, &status);
double offset = offsetHandle.asDouble();
MDataHandle timeHandle = dataBlock.inputValue(mTimeAttr, &status);
MTime t = timeHandle.asTime();
double inputTime = t.as(MTime::kSeconds);
double fps = getFPS();
// scale and offset inputTime.
inputTime = computeAdjustedTime(inputTime, speed, offset/fps);
// this should be done only once per file
if (mFileInitialized == false)
{
mFileInitialized = true;
MDataHandle dataHandle = dataBlock.inputValue(mAbcFileNameAttr);
MFileObject fileObject;
fileObject.setRawFullName(dataHandle.asString());
MString fileName = fileObject.resolvedFullName();
// TODO, make sure the file name, or list of files create a valid
// Alembic IArchive
// initialize some flags for plug update
mSubDInitialized = false;
mPolyInitialized = false;
// When an alembic cache will be imported at the first time using
// AbcImport, we need to set mIncludeFilterAttr (filterHandle) to be
// mIncludeFilterString for later use. When we save a maya scene(.ma)
// mIncludeFilterAttr will be saved. Then when we load the saved
// .ma file, mIncludeFilterString will be set to be mIncludeFilterAttr.
MDataHandle includeFilterHandle =
dataBlock.inputValue(mIncludeFilterAttr, &status);
MString& includeFilterString = includeFilterHandle.asString();
if (mIncludeFilterString.length() > 0)
{
includeFilterHandle.set(mIncludeFilterString);
dataBlock.setClean(mIncludeFilterAttr);
}
else if (includeFilterString.length() > 0)
{
mIncludeFilterString = includeFilterString;
}
MDataHandle excludeFilterHandle =
dataBlock.inputValue(mExcludeFilterAttr, &status);
MString& excludeFilterString = excludeFilterHandle.asString();
if (mExcludeFilterString.length() > 0)
{
excludeFilterHandle.set(mExcludeFilterString);
dataBlock.setClean(mExcludeFilterAttr);
}
else if (excludeFilterString.length() > 0)
{
mExcludeFilterString = excludeFilterString;
}
MFnDependencyNode dep(thisMObject());
MPlug allSetsPlug = dep.findPlug("allColorSets");
CreateSceneVisitor visitor(inputTime, !allSetsPlug.isNull(),
MObject::kNullObj, CreateSceneVisitor::NONE, "",
mIncludeFilterString, mExcludeFilterString);
{
mData.getFrameRange(mSequenceStartTime, mSequenceEndTime);
MDataHandle startFrameHandle = dataBlock.inputValue(mStartFrameAttr,
&status);
startFrameHandle.set(mSequenceStartTime*fps);
MDataHandle endFrameHandle = dataBlock.inputValue(mEndFrameAttr,
&status);
endFrameHandle.set(mSequenceEndTime*fps);
}
}
// Retime
MDataHandle cycleHandle = dataBlock.inputValue(mCycleTypeAttr, &status);
short playType = cycleHandle.asShort();
inputTime = computeRetime(inputTime, mSequenceStartTime, mSequenceEndTime,
playType);
clamp<double>(mSequenceStartTime, mSequenceEndTime, inputTime);
// update only when the time lapse is big enough
if (fabs(inputTime - mCurTime) > 0.00001)
{
mOutRead = std::vector<bool>(mOutRead.size(), false);
//.........这里部分代码省略.........
示例6: doIt
//.........这里部分代码省略.........
queryFolderCmd.format("workspace -en `workspace -q -fre \"^1s\"`",
alembicFileRule);
// query the file rule for alembic cache
MGlobal::executeCommand(queryFileRuleCmd, fileRule);
if (fileRule.length() > 0)
{
// we have alembic file rule, query the folder
MGlobal::executeCommand(queryFolderCmd, expandName);
}
else
{
// alembic file rule does not exist, create it
MString addFileRuleCmd;
addFileRuleCmd.format("workspace -fr \"^1s\" \"^2s\"",
alembicFileRule, alembicFilePath);
MGlobal::executeCommand(addFileRuleCmd);
// save the workspace. maya may discard file rules on exit
MGlobal::executeCommand("workspace -s");
// query the folder
MGlobal::executeCommand(queryFolderCmd, expandName);
}
// resolve the expanded file rule
if (expandName.length() == 0)
{
expandName = alembicFilePath;
}
// get the path to the alembic file rule
MFileObject directory;
directory.setRawFullName(expandName);
MString directoryName = directory.resolvedFullName();
// make sure the cache folder exists
if (!directory.exists())
{
// create the cache folder
MString createFolderCmd;
createFolderCmd.format("sysFile -md \"^1s\"", directoryName);
MGlobal::executeCommand(createFolderCmd);
}
// resolve the relative path
MFileObject absoluteFile;
absoluteFile.setRawFullName(fileName.c_str());
#if MAYA_API_VERSION < 201300
if (absoluteFile.resolvedFullName() !=
absoluteFile.expandedFullName())
{
#else
if (!MFileObject::isAbsolutePath(fileName.c_str())) {
#endif
// this is a relative path
MString absoluteFileName = directoryName + "/" +
fileName.c_str();
absoluteFile.setRawFullName(absoluteFileName);
fileName = absoluteFile.resolvedFullName().asChar();
}
else
{
fileName = absoluteFile.resolvedFullName().asChar();
}
示例7: doIt
MStatus usdImport::doIt(const MArgList & args)
{
MStatus status;
MArgDatabase argData(syntax(), args, &status);
// Check that all flags were valid
if (status != MS::kSuccess) {
MGlobal::displayError("Invalid parameters detected. Exiting.");
return status;
}
JobImportArgs jobArgs;
//bool verbose = argData.isFlagSet("verbose");
std::string mFileName;
if (argData.isFlagSet("file"))
{
// Get the value
MString tmpVal;
argData.getFlagArgument("file", 0, tmpVal);
// resolve the path into an absolute path
MFileObject absoluteFile;
absoluteFile.setRawFullName(tmpVal);
absoluteFile.setRawFullName( absoluteFile.resolvedFullName() ); // Make sure an absolute path
if (!absoluteFile.exists()) {
MGlobal::displayError("File does not exist. Exiting.");
return MS::kFailure;
}
// Set the fileName
mFileName = absoluteFile.resolvedFullName().asChar();
MGlobal::displayInfo(MString("Importing ") + MString(mFileName.c_str()));
}
if (mFileName.empty()) {
MString error = "Non empty file specified. Skipping...";
MGlobal::displayError(error);
return MS::kFailure;
}
if (argData.isFlagSet("shadingMode")) {
MString stringVal;
argData.getFlagArgument("shadingMode", 0, stringVal);
TfToken shadingMode(stringVal.asChar());
if (shadingMode.IsEmpty()) {
jobArgs.shadingMode = PxrUsdMayaShadingModeTokens->displayColor;
}
else {
if (PxrUsdMayaShadingModeRegistry::GetInstance().GetExporter(shadingMode)) {
jobArgs.shadingMode = shadingMode;
}
else {
MGlobal::displayError(TfStringPrintf("No shadingMode '%s' found. Setting shadingMode='none'",
shadingMode.GetText()).c_str());
jobArgs.shadingMode = PxrUsdMayaShadingModeTokens->none;
}
}
}
if (argData.isFlagSet("readAnimData"))
{
bool tmpBool = false;
argData.getFlagArgument("readAnimData", 0, tmpBool);
jobArgs.readAnimData = tmpBool;
}
// Specify usd PrimPath. Default will be "/<useFileBasename>"
std::string mPrimPath;
if (argData.isFlagSet("primPath"))
{
// Get the value
MString tmpVal;
argData.getFlagArgument("primPath", 0, tmpVal);
mPrimPath = tmpVal.asChar();
}
// Add variant (variantSet, variant). Multi-use
std::map<std::string,std::string> mVariants;
for (unsigned int i=0; i < argData.numberOfFlagUses("variant"); ++i)
{
MArgList tmpArgList;
status = argData.getFlagArgumentList("variant", i, tmpArgList);
// Get the value
MString tmpKey = tmpArgList.asString(0, &status);
MString tmpVal = tmpArgList.asString(1, &status);
mVariants.insert( std::pair<std::string, std::string>(tmpKey.asChar(), tmpVal.asChar()) );
}
if (argData.isFlagSet("assemblyRep"))
{
// Get the value
MString stringVal;
argData.getFlagArgument("assemblyRep", 0, stringVal);
std::string assemblyRep = stringVal.asChar();
if (not assemblyRep.empty()) {
//.........这里部分代码省略.........