Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define APPID 1234567
- #include <windows.h>
- #include <iostream>
- using namespace std;
- #include "default_alien_overloads.h"
- using namespace melange;
- //----------------------------------------------------------------------------------------
- /// Implementation of GetWriterInfo to return the exchange / external application ID and name.
- /// @param[in] id Application ID.
- /// @param[in] appname Application string name.
- //----------------------------------------------------------------------------------------
- void GetWriterInfo(Int32 &id, String &appname);
- //----------------------------------------------------------------------------------------
- /// Recursive helper function to traverse the hierarchy under a passed object.
- /// @param[in] baseObj The current object.
- /// @param[in] spacer String taking care of the spacing the output.
- /// @param[in] nestinglevel The counter to the hierarchy level.
- //----------------------------------------------------------------------------------------
- void IterateOverObject(BaseObject* baseObj = nullptr, String spacer = "", Int32 nestingLevel = 0);
- void GetWriterInfo(Int32 &id, String &appname)
- {
- id = APPID;
- appname = "SceneHierarchy";
- }
- void IterateOverObject(BaseObject* baseObj /*= nullptr*/, String spacer /*= ""*/, Int32 nestingLevel /*= 0*/)
- {
- if (nullptr == baseObj)
- return;
- BaseObject *currentObjPtr = baseObj;
- String objName = baseObj->GetName();
- cout << spacer.GetCStringCopy(STRINGENCODING_UTF8) << objName.GetCStringCopy(STRINGENCODING_UTF8) << "["<< nestingLevel <<"]"<<endl;
- spacer += "+";
- nestingLevel++;
- currentObjPtr = baseObj->GetDown();
- while (currentObjPtr)
- {
- IterateOverObject(currentObjPtr, spacer, nestingLevel);
- currentObjPtr = currentObjPtr->GetNext();
- }
- }
- int main(int argc, Char* argv[])
- {
- // Path to the scene to scan.
- const String file = "SceneHierarchy.c4d";
- // Load the scene document.
- BaseDocument *c4dDoc = LoadDocument(file, SCENEFILTER_OBJECTS);
- if (!c4dDoc)
- return -1;
- BaseObject* currentObj = c4dDoc->GetFirstObject();
- while (currentObj)
- {
- IterateOverObject(currentObj, " ", 0);
- cout << endl;
- currentObj = currentObj->GetNext();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement