/* SRSendNewDatabase - send a change-database request to server * * psz name of new database. This name is rootpath'd as the * server may be operating on a different directory/drive */ void SRSendNewDatabase (PSZ psz) { char szFile[MAX_PATH]; { char szTmp[MAX_PATH]; rootpath (psz, szTmp); GetGlobalName (szTmp, szFile); } { HANDLE hServer; char sz[CBMSG]; sprintf (sz, "%s %s", CMD_SET_DATABASE, szFile); hServer = OpenDatabase (FALSE); SendSz (hServer, sz); CloseDatabase (hServer); } }
/* SRSendAddDirectory - send an index-file request to server * * psz name of file to be indexed. This name is rootpath'd as the * server may be operating on a different directory/drive */ void SRSendAddDirectory (PSZ psz) { char szFile[MAX_PATH]; { char szTmp[MAX_PATH]; rootpath (psz, szTmp); GetGlobalName (szTmp, szFile); } { HANDLE hServer; char sz[CBMSG]; sprintf (sz, "%s %s", CMD_ADD_DIRECTORY, szFile); printf ("%s", szFile); hServer = OpenDatabase (TRUE); SendSz (hServer, sz); CloseDatabase (hServer); printf ("\n"); } }
/* * Write files to the given output. This implementation does *not* create * a standalone archive suitable for restore on its own. In particular, the identification of * the application's name etc is not in-band here; it's assumed that the calling code has * taken care of supplying that information previously in the output stream. * * The file format is 'tar's, with special semantics applied by use of a "fake" directory * hierarchy within the tar stream: * * apps/packagename/a/Filename.apk - this is an actual application binary, which will be * installed on the target device at restore time. These need to appear first in the tar * stream. * apps/packagename/obb/[relpath] - OBB containers belonging the app * apps/packagename/r/[relpath] - these are files at the root of the app's data tree * apps/packagename/f/[relpath] - this is a file within the app's getFilesDir() tree, stored * at [relpath] relative to the top of that tree. * apps/packagename/db/[relpath] - as with "files" but for the getDatabasePath() tree * apps/packagename/sp/[relpath] - as with "files" but for the getSharedPrefsFile() tree * apps/packagename/c/[relpath] - as with "files" but for the getCacheDir() tree * * and for the shared storage hierarchy: * * shared/[relpaths] - files belonging in the device's shared storage location. This will * *not* include .obb files; those are saved with their owning apps. * * This method writes one file data block. 'domain' is the name of the appropriate pseudo- * directory to be applied for this file; 'linkdomain' is the pseudo-dir for a relative * symlink's antecedent. * * packagename: the package name to use as the top level directory tag * domain: which semantic name the file is to be stored under (a, r, f, db, etc) * linkdomain: where a symlink points for purposes of rewriting; current unused * rootpath: prefix to be snipped from full path when encoding in tar * path: absolute path to the file to be saved * dataOutput: the BackupDataOutput object that we're saving into */ static int backupToTar(JNIEnv* env, jobject clazz, jstring packageNameObj, jstring domainObj, jstring linkdomain, jstring rootpathObj, jstring pathObj, jobject dataOutputObj) { int ret; // Extract the various strings, allowing for null object pointers const char* packagenamechars = (packageNameObj) ? env->GetStringUTFChars(packageNameObj, NULL) : NULL; const char* rootchars = (rootpathObj) ? env->GetStringUTFChars(rootpathObj, NULL) : NULL; const char* pathchars = (pathObj) ? env->GetStringUTFChars(pathObj, NULL) : NULL; const char* domainchars = (domainObj) ? env->GetStringUTFChars(domainObj, NULL) : NULL; String8 packageName(packagenamechars ? packagenamechars : ""); String8 rootpath(rootchars ? rootchars : ""); String8 path(pathchars ? pathchars : ""); String8 domain(domainchars ? domainchars : ""); if (domainchars) env->ReleaseStringUTFChars(domainObj, domainchars); if (pathchars) env->ReleaseStringUTFChars(pathObj, pathchars); if (rootchars) env->ReleaseStringUTFChars(rootpathObj, rootchars); if (packagenamechars) env->ReleaseStringUTFChars(packageNameObj, packagenamechars); // Extract the data output fd BackupDataWriter* writer = (BackupDataWriter*) env->GetIntField(dataOutputObj, sBackupDataOutput.mBackupWriter); // Validate if (!writer) { LOGE("No output stream provided [%s]", path.string()); return -1; } if (path.length() < rootpath.length()) { LOGE("file path [%s] shorter than root path [%s]", path.string(), rootpath.string()); return -1; } return write_tarfile(packageName, domain, rootpath, path, writer); }
void Exporter::extractJointData(MDagPath path) { MFnTransform joint(path); int childcount = joint.childCount(); MFnDagNode rootpath(joint.parent(0)); if (!strcmp(rootpath.fullPathName().asChar(), "")) RecursiveJointExtraction(joint, -1); // MFloatMatrix res; // cout << path.partialPathName().asChar() << std::endl; // MMatrix invMat; // // MStatus status; // MTransformationMatrix restpose = joint.restPosition(&status); // // cout << status <<" "<< restpose.asMatrix() << endl; // // // jointTrans jt; // // //attach the function set to the object // MFnTransform tr(path); // // // Gets transform data as a matrix, though quaternions more interesting! :D // MMatrix mat = tr.transformation().asMatrix(); // // MQuaternion JointOrient(0, 0, 0, 1); // MQuaternion Rotation(0, 0, 0, 1); // // //Get the transforms local translation // MVector Translation = tr.translation(MSpace::kTransform); // // //Get the transforms scale // tr.getScale(jt.scale); // // //Get the transforms rotation as quaternions // tr.getRotation(Rotation); // // //IK joints contains both joint orientations as well as a rotation, therefore I check for the transform of an IK // if (tr.object().hasFn(MFn::kJoint)) // { // MFnIkJoint IKjoint(tr.object()); // IKjoint.getOrientation(JointOrient); // } // // //Get Translation data // jt.tx = Translation.x; // jt.ty = Translation.y; // jt.tz = Translation.z; // // //Get Rotation Data // jt.rx = Rotation.x; // jt.ry = Rotation.y; // jt.rz = Rotation.z; // jt.rw = Rotation.w; // // //Get Joint Orientation Data // jt.rox = JointOrient.x; // jt.roy = JointOrient.y; // jt.roz = JointOrient.z; // jt.row = JointOrient.w; // // // MObject jointNode = path.node(); // MFnDependencyNode fnJoint(jointNode); // MObject attrWorldMatrix = fnJoint.attribute("worldMatrix"); // // MPlug plugWorldMatrixArray(jointNode, attrWorldMatrix); // // for (unsigned i = 0; i < plugWorldMatrixArray.numElements(); i++) // { // MPlug elementPlug = plugWorldMatrixArray[i]; // // MItDependencyGraph dgIt(elementPlug, MFn::kInvalid, MItDependencyGraph::kDownstream, MItDependencyGraph::kDepthFirst, MItDependencyGraph::kPlugLevel); // // dgIt.disablePruningOnFilter(); // // for (; !dgIt.isDone(); dgIt.next()) // { // MObject thisNode = dgIt.thisNode(); // // if (thisNode.apiType() == MFn::kSkinClusterFilter) // { // MFnSkinCluster skinFn(thisNode); // // MPlug bindPreMatrixArrayPlug = skinFn.findPlug("bindPreMatrix"); // int logicalIndex = skinFn.indexForInfluenceObject(path); // MPlug bindPreMatrixPlug = bindPreMatrixArrayPlug.elementByLogicalIndex(logicalIndex); // MObject dataObject; // bindPreMatrixArrayPlug.getValue(dataObject); // // MFnMatrixData matDataFn(dataObject); // // invMat = matDataFn.matrix().inverse(); // res = invMat.matrix; // cout << logicalIndex << std::endl; // } // } // } // std::cout << res << std::endl; }