Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Get document name / was: More doc issues [SOLVED]

    SDK Help
    0
    5
    380
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 13/12/2014 at 21:45, xxxxxxxx wrote:

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

      ---------
      Hi folks,

      I'm having a bit of an issue with this one (similar to a previous topic of mine). I'm not sure why, it was working up until recently. I don't know when it stopped working though.

      Example - in my ObjectData's Execute() method, there's something not right about the passed "doc" variable. I'm testing for whether the doc is null, and it's not, but printing it's name gives nothing. Don't know if this is related to the issue in another topic of mine on trying to copy references etc, but in almost all places this is happening.

        
      EXECUTIONRESULT MyObjectPlugin::Execute(BaseObject* op,BaseDocument* doc,BaseThread* bt,LONG priority,EXECUTIONFLAGS flags)   
      {   
          if(doc == NULL)   
          {   
              GePrint("doc is NULL");   
          }   
          else   
          {   
              GePrint("doc name is: " + doc->GetName());   
          }   
        
          // The "else" braces above run, and the   
          // print given is "doc name is:" - that's   
          // all. No document name. The same prints   
          // occur regardless of whether the document   
          // is a new scene, or previously saved one.   
        
          return EXECUTIONRESULT_OK;   
      }   
      

      As I mentioned before, it was working, but now it does the above. Any ideas on what might be causing this? Or any thoughts on what I could look into?

      WP.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 15/12/2014 at 02:23, xxxxxxxx wrote:

        Hi WickedP,

        is it GetDocumentName() you want to use?

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 15/12/2014 at 19:47, xxxxxxxx wrote:

          Hi Andreas,

          yep, that's what it was. I knew something was fishy about it but couldn't remember it. Just out of interest, I realise that GetName() returns a string and GetDocumentName() a Filename, but if BaseDocument derives from BaseList2D, how come GetName() won't work - how come the document's name does not carry over for us to use GetName()?

          Cheers,

          WP.

          EDIT: interest query re-worded!

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 17/12/2014 at 06:51, xxxxxxxx wrote:

            To be honest, I don't know.
            Perhaps, because a document has no "String name", but a "Filename" instead. While it would be certainly possible to deliver the String of the Filename via GetName(), what would be the use?
            But that's only my personal explanation.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 17/12/2014 at 14:37, xxxxxxxx wrote:

              I was thinking from a users perspective, in that 'GetName' is a bit more common than something like a 'GetDocumentName'. If a user uses GetName() on a BaseObject, it would be generally speaking, easier in "flow" to know that GetName() can be used on other object types as well. GetDocumentName() should perhaps be GetFileName instead, so that users have two clear and concise methods, rather than one that doesn't seem to work, and the other perhaps being a little more busy/obscure to find/use without knowing it. Don't know if that makes sense, but I'm only thinking of the way I look at the SDK and how I work. Bare in mind I'm coming from a non-coders background, but I think it would be cleaner for the user/coder to have common ground to work off of with small things like this.

              Just a thought! Cheers,

              WP.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post