saving Volume loader object
-
Hi @camille-chigot, your question will be looked tomorrow morning in our daily SDK checks, however try again, it should work now, but we do have a file limit of 4096KiB (around 4.19mo) so if the file is larger either send us the file via mail at [email protected] or upload it within your preferred cloud hosting provider.
Cheers,
Maxime. -
vdb file uploaded animmetacloud_Small Cumulonimbus [RefObj]_00.vdb
-
also a bug on C4d on Ovolume object ( not sure when to post this).
The reload button modify the postion/scale of the object without taking into account if the object is in a group ( in my case, it is in a group with a 100 scale, that means my cloud is magically transported far away).
The stranger thing, is that the reload seems to be called when I load the scene. But if the object is animated, the reload is applied before the move to the position defined in the position Curve. The result is, the animated cloud is correctly placed whereas the non-animated one is not ( in fact, the position stored in the c4d file is completely ignored) -
Hi Camille one of the things that is a bit unclear to us, are you really using the cineware engine, or do you actually uses the sdk.zip provided in each Cinema 4D?
Cineware is an external dll that you can link to read/write c4d file without the need to install c4d. Since you mention that you want to create an exporter this is more suited for the usual sdk.Would it be possible for you to share your actual code?
Thanks in advance,
Cheers,
Maxime. -
we are using the cineware SDK from developers maxon net , I can't say for sure what version it is ( it was updated in june 2020, is there a header file where the exact version is stated?). I downloaded the latest version and builded it to use the command line sample that parses a save file ( to check the difference between what I save and what is saved after loading in C4d ( R23).
I won't be able to give you the whole code ( at least my legal department is likely to fire me ), but I can give you a sample of what we do for the clouds.//create cloud object cineware::BaseObject* c4Cloud; if (gridNames_.size()>0) { c4Cloud = cineware::BaseObject::Alloc(Ovolumeloader); if (startFrame_ != endFrame_) { cineware::GeData udata; udata.SetInt32(1); c4Cloud->SetParameter(6001, udata); //animation udata.SetInt32(startFrame_); c4Cloud->SetParameter(6003, udata); //frame range start udata.SetInt32(endFrame_); c4Cloud->SetParameter(6004, udata); //frame range stop cineware::ListViewData* lv = cineware::ListViewData::Alloc(); for (size_t i = 0; i < gridNames_.size(); ++i) { cineware::GeData vdata; vdata.SetInt32(1); lv->AddItem((int)i, ToCinewareString(gridNames_[i]), vdata); } udata.SetCustomDataType(CUSTOMDATA_LISTVIEW, *lv); c4Cloud->SetParameter(6008, udata); //list of activated grids } else { cineware::GeData udata; udata.SetInt32(0); c4Cloud->SetParameter(6001, udata); //animation udata.SetInt32(startFrame_); c4Cloud->SetParameter(6002, udata); //frame } } else { c4Cloud = cineware::BaseObject::Alloc(Ovolume); } c4dDoc_->InsertObject(c4Cloud, parentObj); c4Cloud->SetName(ToC4dStr(name).c_str()); // set vdb file path cineware::GeData udata; auto newPath = EONPath(file_); if (startFrame_ != endFrame_) { cineware::CTrack* xTrack( cineware::CTrack::Alloc(c4Cloud, cineware::DescLevel(cineware::ID_VOLUME_PATH, cineware::DTYPE_FILENAME, 0), "path")); c4Cloud->AppendCTrack(xTrack); xTrack->t_pseudo = cineware::PSEUDO_DATA; //hack to be able to create pseudo data track auto curve = xTrack->GetCurve(); for (auto time = startFrame_; time <= endFrame_; ++time) { auto path = newPath; // build file name of frame XX path.insert_suffix_before_ext_inplace( StringFormat(EONString(L"_%0") + boost::lexical_cast<std::wstring>(floor(log(endFrame_ - startFrame_) / log(10) + 1)) + L"d", time)); auto mapPath = MakeRelPath(path, GetSettings().localTexturePath_, Filename()); // relative or absolute path cineware::GeData data; data.SetFilename(cineware::Filename(ToCinewareString(mapPath.local_string()))); curve->AddKey(cineware::BaseTime(time ,GetSettings().animationFramerate_ ))->SetGeData(curve, data); } // build file name of frame 0 newPath.insert_suffix_before_ext_inplace( StringFormat(EONString(L"_%0") + boost::lexical_cast<std::wstring>(floor(log(endFrame_ - startFrame_) / log(10) + 1)) + L"d", 0)); } EONPath mapPath = MakeRelPath(newPath, GetSettings().localTexturePath_, Filename());// relative or absolute path udata.SetFilename(cineware::Filename(ToCinewareString(mapPath.local_string()))); c4Cloud->SetParameter(cineware::ID_VOLUME_PATH, udata); // set transformation of object in absolute or relative to parent if (transfo_.hasParent_) { InitNodeTransform(c4Cloud, transfo_.localPosition_, transfo_.localTransfo_, false); } else { InitNodeTransform(c4Cloud, transfo_.vPosition_, transfo_.transfo_, true); }
-
Hi,
to answer some of your question:
- the last cineware version is 22.004. There's a build.txt at the root. (Should be defined with API_VERSION, but that's not the case for Cineware.
- Ovolumeloader isn't defined: cineware is not updated on each release, that probably why. I will check with the devs.
So, if i got you correctly, you export a vdb file from VUE. Using Cineware, you create a new document, insert a volume object, define the file path and animation parameter. When you check the .c4d you have an issue if the file is set as a relative reference?
I tried with the last cineware version and i couldn't reproduce the issue:
I did used the commandline example and redefined the main function as follow, where cloud.vdb is the file you provided in the same path of commandline.exe ([] in the name isn't an issue)
When i'm loading the created c4d, i find the two grids.
int main(int argc, Char* argv[]) { #define Ovolumeloader 1039866 const char* fnLoad = "cloud.vdb"; const char* fnc4dSave = "c4d_cloud.c4d"; // create new C4D base document (for export we don't need a alien document) BaseDocument* newC4DDoc = BaseDocument::Alloc(); if (!newC4DDoc) { return 1; } // create new file for export HyperFile* newC4Dfile = NewObj(HyperFile); if (!newC4Dfile) { DeleteObj(newC4DDoc); return false; } // open file for write if (!newC4Dfile->Open(DOC_IDENT, fnc4dSave, FILEOPEN_WRITE)) { DeleteObj(newC4DDoc); DeleteObj(newC4Dfile); return false; } cineware::BaseObject* c4Cloud = cineware::BaseObject::Alloc(Ovolumeloader); cineware::GeData udata; udata.SetFilename(cineware::Filename("cloud.vdb")); c4Cloud->SetParameter(cineware::ID_VOLUME_PATH, udata); newC4DDoc->InsertObject(c4Cloud, nullptr); c4Cloud->SetName("my could"); newC4DDoc->CreateSceneToC4D(true); newC4DDoc->Write(newC4Dfile); // close the C4D file newC4Dfile->Close(); BaseDocument::Free(newC4DDoc); DeleteObj(newC4DDoc); // free the new C4D file DeleteObj(newC4Dfile); // to keep the console window open wait here for input char value; printf("\n <press return to exit>"); scanf("%c", &value); }
Cheers,
Manuel -
ok, I did the same with puting "cloud_00.vdb" in the Filename and having in my folder "cloud_00.vdb" to "cloud_64.vdb". It works fine. but somehow it does not work with filename "animmetacloud_Small Cumulonimbus [RefObj]_00.vdb". I tried other filenames, it works fine. I don't know why the particular filename does not work.
-
This post is deleted! -
Hello @camille-chigot,
without any further questions, we will consider this topic as solved by Monday, the 25th and flag it accordingly.
Thank you for your understanding,
Ferdinand -
Hello, Some news about this topic,
it seems that the length of the folder where I save the c4d file have an incidence on whether the volumeloader work correctly or not ( C4d R23).
if I save the file to E:\data\tests\export\USD, the volume loader does not work, If I save the same thing to E:\USD, it works.
here are the files ( I renamed the files afterwards, tell me if you find a difference )
Untitled2_longfolder.c4d
Untitled2_shortfolder.c4d Untitled2_Dense Stratus.vdb Untitled2_Cumulus.vdb
the files' reference are relative so they should load fine. ( at least in a short folder)