Hook or message prior to file open?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/07/2009 at 15:28, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11.027 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi All,

    Is there a message or a hook that Cinema sends just prior to opening a file?

    Here's why I'm looking for this functionality:

    Some of our texture file names contain custom tokens and environment variables that must be resolved in order to obtain the actual path to the file. For example:

    {XXX}/myfile.tif

    Just before a texture is opened, I want to obtain the filename string, resolve it, then pass the absolute filename to Cinema.

    This cannot be done in a file select dialog, because we don't want the resolved string to appear in the shader gui or to be saved with the .c4d file. Instead, we want to save the unresolved string.

    Is this possible?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/07/2009 at 02:46, xxxxxxxx wrote:

    I don't think this is possible. Maybe a better solution would be to have an external application that resolves the tokens into real paths.

    I will ask the developers though if there is a solution within CINEMA 4D.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/07/2009 at 11:21, xxxxxxxx wrote:

    Even if we had an external app that resolved the tokens, we would still have to know when to call that app. So we would still need some kind of callback just before the file is opened.

    We want to store the unresolved string in the Cinema4D file, not the real path.

    Thanks!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/07/2009 at 03:02, xxxxxxxx wrote:

    Just got work back from the developers. Unfortunatly this is not really possible. The only thing you can do is to decode the paths after loading a document and encode them again before saving. The according messages are MSG_DOCUMENTINFO_TYPE_LOAD and MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/07/2009 at 11:55, xxxxxxxx wrote:

    Cool! Using MSG_DOCUMENTINFO_TYPE_LOAD, I can implement something like this:

    1. Using our custom file selection dialog, user selects a texture file that may or may not contain an encoded path.

    2. File selection dialog evaluates the path, passes the absolute path to Cinema4D.

    3. File selection dialog sets the encoded path as "User Data" on the shader.

    4. Add a handler for MSG_DOCUMENTINFO_TYPE_LOAD, which crawls through all materials, evaluates "User Data" and replace paths as needed.

    That might actually work -- thanks!


Log in to reply