Load/Merge file not working for me



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

    On 04/04/2011 at 15:48, xxxxxxxx wrote:

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

    ---------
    Hi,

    Shawn has been trying to help me figure out how to merge a file into my scene.
    But it's not working for me for some reason:

      
      Filename file = GeGetPluginPath() + "C:/Users/user/Desktop/test.c4d";     
      MergeDocument(doc, file, SCENEFILTER_MERGESCENE, NULL);  
      LoadFile(file);  
    

    I get no errors. But nothing happens when I execute the plugin.

    On a possibly related issue. When I try to create a dialog window for the user to pick a file from.
    I cannot make the dialog window start from a specific folder:

      
      Filename file;  
      Filename dir = GeGetPluginPath() + "C:/Users/user/Desktop"; //the dialog should start at this folder. But doesn't.  
      file.SetDirectory(dir);  
      file.FileSelect(FILESELECTTYPE_SCENES, FILESELECT_LOAD, "Choose a file");                  
      LoadFile(file);  
    

    The dialog window always opens up from a previously opened folder. And is ignoring the GeGetPluginPath() + "C:/Users/user/Desktop"; code.

    Since the dialog window code isn't finding my path. I can see how this would also prevent the Merge code from working too.
    So my question is....Why is my path code not working. When it seems to work for everyone else?

    -ScottA



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

    On 04/04/2011 at 17:27, xxxxxxxx wrote:

    Why are you adding a full file path to the GeGetPluginPath()?  GeGetPluginPath() returns the full path to your plugin folder (i.e.: "C:\Program Files\Maxon\Cinema 4D R12\Plugins\My Plugin").



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

    On 04/04/2011 at 18:07, xxxxxxxx wrote:

    I've been told that this is the way to do it.
    Like in this thread: https://plugincafe.maxon.net/topic/5492/5511_open-a-scene-file&KW=files&PID=22708#22708

    Is there another way to load/merge files from a specifc path?

    -ScottA



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

    On 04/04/2011 at 18:10, xxxxxxxx wrote:

    The way in the other thread was adding a folder or file in the plugin's path.  To set the absolute path, just do this:

      Filename file = Filename("C:/Users/user/Desktop");  
      file.FileSelect(FILESELECTTYPE_SCENES, FILESELECT_LOAD, "Choose a file");  
      LoadFile(file);
    


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

    On 04/04/2011 at 18:55, xxxxxxxx wrote:

    Well...Using my previous code. I did try putting the target file I wanted to merge inside of my plugin folder as a test.  And it didn't work.
    I also tried putting my target file in the main plugin folder, and the maxon folder itself. Just trying to see if any of them would be found by my path code...None worked.

    The code you posted does the same thing.
    The dialog window does open. But not at the Desktop folder(or any other folder I set it to). It still doesn't listen to the path inside of Filename("C:/Users/user/Desktop");

    I'm mainly interested in merging files.
    The only reason I brought up the load dialog window was because that's acting strangely too. And I thought it might help figure out what's going on.

    I'm at a loss why my paths are being ignored.
    It seems to work fine for everyone else.

    -ScottA



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

    On 04/04/2011 at 19:03, xxxxxxxx wrote:

    First, you need to use proper path separators.  For Windows, you use \ not /.  You will need to consider paths on MacOS if you are going to support that OS as well.

    Also, you are sure that "C:\Users\user\Desktop" will exist?  On my system, I have boots into C:, D:, and G: and no user named 'user'.  For testing, this may be okay but for general use you will need to be flexible. :)



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

    On 04/04/2011 at 19:32, xxxxxxxx wrote:

    Yes. The folder exists.
    I install all of my OS with the name of "Users\user". That way I don't run the risk of forgetting what name I chose.
    Don't laugh...My memory really is that bad. 😂
    Besides. I have no problem merging and loading files with Coffee&Python.
    It's only C++ that's giving me these strange problems.

    I can't use  \  in my file paths.
    Intellisence won't let me. And it won't compile unless I use these  /   type of slashes.

    -ScottA



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

    On 04/04/2011 at 21:29, xxxxxxxx wrote:

    Sure you can use \.  It's called 'escaping' and you use the \ to escape (hint, hint). 😉

      Filename file = Filename("C:\\Users\\user\\Desktop");  
      file.FileSelect(FILESELECTTYPE_SCENES, FILESELECT_LOAD, "Choose a file");  
      LoadFile(file);
    


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

    On 05/04/2011 at 08:03, xxxxxxxx wrote:

    That's it!

    I've done all kinds of separator gymnastics in C# before. But I not in C++.
    I manged to get my merge code working now too.

    Thanks a lot Robert,
    This was driving me crazy.

    -ScottA


Log in to reply