Torque 3D 3.8
ContentsIndexHome
PreviousUpNext
_FileObjectwriteObject2 Function
Syntax
C++
static ConsoleDocFragment _FileObjectwriteObject2("@brief Write an object to a text file, with some data added first.\n\n" "Unlike a simple writeLine using specified strings, this function writes an entire object " "to file, preserving its type, name, and properties. This is similar to the save() functionality of " "the SimObject class, but with a bit more control.\n\n" "@param object The SimObject being written to file, properties, name, and all.\n" "@param prepend Data or text that is written out before the SimObject.\n\n" "@tsexample\n" "// Let's assume this SpawnSphere was created and currently\n" "// exists in the running level\n" "new SpawnSphere(TestSphere)\n" "{\n" " spawnClass = \"Player\";\n" " spawnDatablock = \"DefaultPlayerData\";\n" " autoSpawn = \"1\";\n" " radius = \"5\";\n" " sphereWeight = \"1\";\n" " indoorWeight = \"1\";\n" " outdoorWeight = \"1\";\n" " dataBlock = \"SpawnSphereMarker\";\n" " position = \"-42.222 1.4845 4.80334\";\n" " rotation = \"0 0 -1 108\";\n" " scale = \"1 1 1\";\n" " canSaveDynamicFields = \"1\";\n" "};\n\n" "// Create a file object for writing\n" "%fileWrite = new FileObject();\n\n" "// Open a file to write to, if it does not exist it will be created\n" "%fileWrite.OpenForWrite(\"./spawnSphers.txt\");\n\n" "// Write out the TestSphere, with a prefix\n" "%fileWrite.writeObject(TestSphere, \"$mySphere = \");\n\n" "// Close the text file\n" "%fileWrite.close();\n\n" "// Cleanup\n" "%fileWrite.delete();\n" "@endtsexample\n\n\n", "FileObject", "void writeObject( SimObject* object, string prepend);");

This is function _FileObjectwriteObject2.

Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!