Project path when running from command line
-
On 22/12/2015 at 01:38, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;---------
Hello.I have a very simple scene (1 cube) with 1 textured material.
When i render it using the commandline.exe and -render as parameter, the texture is missing.
So i add some prints to check the texture path and document name and i see that when it is run from command line, the project name is Untitled, document path empty and the texture path empty as well.
I check the texture path using the GenerateTexturePath.When you create a new project, the document name is untitled and the document path empty.
Why does my project have these characteristics ?
Do i have to handle my project differently when run from command line ?Edit
Here is the command i am using:
commandline.exe -render "E:\scenes\simple.c4d" -frame 38 38 -take "Main" -oimage "E:\scenes\Renderings\Prefix"and here is how i check the document path:
BaseDocument* doc = GetActiveDocument(); String doc_name = doc->GetDocumentName().GetFileString(); String doc_path = doc->GetDocumentPath().GetString(); //full path Filename texture_file; GenerateTexturePath(doc->GetDocumentPath(), Filename("any_texture.jpg"), Filename() , &texture_file);
Thank you for your time.
-
On 29/12/2015 at 03:35, xxxxxxxx wrote:
Hi,
Never access the active document from any NodeData plugin with GetActiveDocument(). This leads to issues while rendering.
Use instead the passed document to the methods override. It's usually passed as parameter 'doc' or inside a data structure, for instance BaseVideoPostStruct::doc or InitRenderStruct::doc.Sorry for the delay to answer.
-
On 29/12/2015 at 04:14, xxxxxxxx wrote:
Hello.
Thank you very much for your answer.
I will try that !thnx.
-
On 29/12/2015 at 04:35, xxxxxxxx wrote:
Hello again.
Is it correct to use node->GetDocument() where node is the GeListNode for the NodeData plugin ?
Thank you.
-
On 29/12/2015 at 06:38, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Is it correct to use node->GetDocument() where node is the GeListNode for the NodeData plugin ?
Yes, the document returned by node->GetDocument() should be valid.
-
On 04/01/2016 at 01:50, xxxxxxxx wrote:
Hello.
I have a MaterialData plugin.
To generate the material preview, i use my own renderer in MATPREVIEW_GENERATE_IMAGE event of the Message(....) method.
To render properly the material, the texture paths are required.There is a huge problem here because node->GetDocument()->GetDocumentPath() returns:
<Cinema4D R17 dir>\resource\modules\xtensions\preview_scenesThis causes GenerateTexturePath to fail because the doc path is wrong.
Is it safe to use the GetActiveDocument() when i am about to generate the material preview ?Thank you.
-
On 04/01/2016 at 03:41, xxxxxxxx wrote:
Hello,
is your question still related to command line rendering?
Best wishes,
Sebastian -
On 04/01/2016 at 03:49, xxxxxxxx wrote:
Hello dear S_Bach.
I am not sure about that.
The problem with the command line rendering is that i was using GetActiveDocument instead of node->GetDocument().But as it seems node->GetDocument doesn't return always a valid result (e.g. in MATPREVIEW_GENERATE_IMAGE event of the MaterialData::Message(...))
Thank you.
-
On 04/01/2016 at 09:07, xxxxxxxx wrote:
Hello,
in a command line environment there is no GUI and therefore not material preview image. So this situation should not occur.
Rendering the the material preview image is as far as I can tell the only situation when it is acceptable to use GetActiveDocument() since one renders the preview image only for the currently active document.
Best wishes,
Sebastian