Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    DescEdit (Descriptionfiles Editor)

    SDK Help
    0
    39
    23.0k
    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

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

      On 27/05/2011 at 10:32, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:      
      Language(s) :

      ---------
      Hi there,

      as writing descriptions really drives my patience to hell I'm now going to write an DescriptionEditor.
      I wanted to make sure that it will be complete.
      I've now got the following classes that already can create a .res file. 😉

      CONTAINER  
      GROUP  
      ELEMENT         // i.e. a BUTTON, BOOL, or whatever you want  
      CYCLE  
      ID              //used for CYCLE
      

      An idea if something is missing ?

      Thanks, Niklas

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

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

        On 27/05/2011 at 10:44, xxxxxxxx wrote:

        That's a very good idea! Good call and thanks for getting at it!

        Cheers
        Lennart

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

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

          On 28/05/2011 at 01:27, xxxxxxxx wrote:

          So, there's nothing missing ?

          Thanks,
          Niklas

          Ps: just a screenshot of the result of a programatically created .res file.

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

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

            On 28/05/2011 at 10:28, xxxxxxxx wrote:

            Can you do the .h and .str files as well?  And is this WYSIWIG at all or something else?

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

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

              On 28/05/2011 at 10:40, xxxxxxxx wrote:

              Yes, .h and .str files will be created, too.
              I've just finished the code for doing it.

              Here's an example (still programatically created) description.
              download

              Can you spot any issues ?

              Thanks, Niklas
              PS: That's the sourcecode used for it: Click here
              I think it won't be that hard to implement this in a Dialog.

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

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

                On 28/05/2011 at 15:18, xxxxxxxx wrote:

                Looks very interesting. So at the moment you have a standalone python app, is that right? And you still have a lot of code to add to prompt for user choices (names, strings, flags, etc.) and editing/deleting/adding elements in the description?

                Are you going to keep this as standalone code or do it within Cinema? In C4D makes a GUI easier, as standalone you'd need to add some sort of widgets library for your GUI.

                The big question as I see it is whether you're going to make this like the existing resource editor and let the user see the description as it is edited (i.e. WYSIWYG as Robert said). That would be extremely valuable.

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

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

                  On 28/05/2011 at 16:08, xxxxxxxx wrote:

                  The classes all have been finished. (If you couldn't spot any errors in the output 😉 )

                  Yea, I want to make it like ResEdit. Of course it would be very nice to see the endresult, but I don't think it'spossible.
                  What I could do instead, is making a Previw-Dialog that shows at least the dialog-way of the description.

                  But for now, I just want to make the gui likethis:

                  The user can add the elements, they will be displayed in a list (I need some kind of TreeView, still didn't figure out if and how I can use ListView, TreeView, etc) and their values can be edited.
                  So there won't be a preview. (Well, yea. It would be WYSIWYG) But through the generated code, there shouldn be any errors if you finish the description, as they may appear when you write it yourself.
                  Also, it's less to write.

                  I already started to build a Dialog. I can show it to you tomorrow, then you might understand better how i imagine it. 🙂
                  (sorry for my bad english xD. I'm tired . hehe ^^)

                  Cheers

                  PS: And I'm not quite sure how I should implement multilanguage and reopening descriptions...

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

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

                    On 29/05/2011 at 01:08, xxxxxxxx wrote:

                    Originally posted by xxxxxxxx

                    Yea, I want to make it like ResEdit. Of course it would be very nice to see the endresult, but I don't think it'spossible.What I could do instead, is making a Previw-Dialog that shows at least the dialog-way of the description.

                    The problem with the dialog approach is that description resources are dfferent from dialog resources, so you'd have to alter your resource on the fly to make it appear in a dialog. I wonder if it is possible to show a description which changes on editing? Maybe GetDDescription would let you do it - create something like a dummy ObjectData plugin then alter its description as required?

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

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

                      On 29/05/2011 at 01:18, xxxxxxxx wrote:

                      Exactly that is the problem. As I said, maybe it's possible to show at least a dialog-version of the description. (Better than nothing)

                      I don't think GetDDescription is available in Python. (Never seen it, but also don't know what it does)
                      What would work, is to clean the loaded description from C4D. So
                      it has to reload it. But how to clean it ? 😜

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

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

                        On 29/05/2011 at 05:46, xxxxxxxx wrote:

                        GetDDescription allows you to load elements into a description at runtime. So you might start by loading a very basic skeleton for the description, then add additional elements as needed. My simbiont plugin does this when it loads a dark tree file from disc. The code is convoluted but seems to work 🙂

                        There's also the description class with the function LoadDescription(), which loads (or, I guess, re-loads) a named description from disk. This might do what you want in terms of resetting a plugin's description.

                        Whether you could make these functions work in conjunction with a dialog which edits the description content, I don't know. And it sounds like you need C++ anyway.

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

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

                          On 29/05/2011 at 12:19, xxxxxxxx wrote:

                          Well, if it will be added, it will be added later.

                          Here's the GUI I'd like to use:
                          The only problem now is the TreeView used in the Main, the Group Dialog and the Cycle Dialog.

                          Main:

                          Group:

                          Element:

                          Cycle:
                          click here

                          Edit:
                          Oh spotted an issue in the Group-Dialog. Of course the type does not have to be defined.

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

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

                            On 30/05/2011 at 09:51, xxxxxxxx wrote:

                            As it seems like one can not acess the ListView element using Python, I just wrote my own subclassing a GeUserArea 🙂

                            http://www.screenr.com/dfI

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

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

                              On 31/05/2011 at 08:12, xxxxxxxx wrote:

                              That's cool.
                              I've been wanting to explore making custom gui's. Mostly with C++. But also in Python.
                              But I haven't found any examples to get me started.

                              I copied your code from the video. But I'm not getting any text to show up. Just the black background.

                              -ScottA

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

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

                                On 31/05/2011 at 08:45, xxxxxxxx wrote:

                                Hm, send me the code and I will try to find the issue. 🙂

                                Cheers,

                                PS: Do you know how to load a dialog ressource with python ? I can't get it to work, because the ID doesn't seem to be transferred into the Pluginscope.

                                In coffe it would be:

                                LoadDialogRessource(DESCEDIT_MAIN, 0);
                                

                                In Python:

                                self.LoadDialogRessource(DESCEDIT_MAIN)
                                

                                but the DESCEDIT_MAIN variable isn't declared. Confused

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

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

                                  On 31/05/2011 at 09:33, xxxxxxxx wrote:

                                  Can I post my code here?
                                  That way other people can learn from it too.

                                  I'm afraid  I probably can't help  you out with your loader problem.
                                  But from the first glance. It looks like maybe you forgot to add the c4d. prefix?

                                    
                                      
                                      
                                      self.LoadDialogRessource(c4d.DESCEDIT_MAIN)
                                  

                                  -ScottA

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

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

                                    On 31/05/2011 at 09:36, xxxxxxxx wrote:

                                    Unfortunately it's not loaded into the c4d module.
                                    Would also be fatal. 😉

                                    Yes, of course you can post it here, too.
                                    But I con't have the time now. Will test it tomorrow.
                                    Cheers,

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

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

                                      On 31/05/2011 at 10:35, xxxxxxxx wrote:

                                      I took a look through my Coffee stuff to see if I had anything using LoadDialogResource().
                                      And I found one example:

                                      MyDialog::CreateLayout() //This creates the dialog gizmos using an external .res file  
                                      {  
                                       var resources = LoadDialogResource(IDD_DIALOG_MyDialog, plugin_resources,BFH_SCALEFIT | BFV_SCALEFIT); // Loads the gizmo descriptions from a .res file  
                                       return resources;  
                                      }
                                      

                                      "IDD_DIALOG_MyDialog"  is the name of the .res file located in my res folder.
                                      I don't know if that will help you with your python project or not.
                                      But it's the only example I have.

                                      Here's my custom gui code that I copied from your video:

                                      import c4d  
                                      from c4d import gui  
                                        
                                      def isIterateable(item) :  
                                       try:  
                                        item[0]  
                                        
                                       except:  
                                      return False  
                                       else:  
                                      return True  
                                        
                                      class ListViewData:  
                                       def __init__(self, iterateableData) :  
                                        if not isIterateable(iterateableData) :  
                                          raise TypeError, "%s must be initialized with an iterateable value" %self.__class__.__name__  
                                        self.data = iterateableData  
                                        
                                       def GetColumn(self, index) :  
                                        if index > len(self.data) :  
                                        return  
                                        else:  
                                        return self.data[index]  
                                        
                                       def GetLengthOfData(self) :  
                                      return len(self.data)  
                                        
                                      class MyUA(gui.GeUserArea) :  
                                        colors = {  
                                                "background": c4d.Vector(.2),  
                                                "lighter": c4d.Vector(.6),  
                                                "darker": c4d.Vector(.8, .4, .2),  
                                                "marked": c4d.Vector(.2),   
                                                "text": c4d.Vector(.1),  
                                                "markedText": c4d.Vector(.7, .5, .6),  
                                               }  
                                        
                                        
                                        def __init__(self, rowheight, data, columnwidth = (100, )) :  
                                      if not isIterateable(data) :  
                                        raise TypeError, "%s must be initialized with an iterateable value" %self.__class__.__name__  
                                          
                                      self.minimumHeight = rowheight * len(data)  
                                      self.rowheight = rowheight  
                                      self.columnwidth = columnwidth  
                                      self.data = data  
                                      self.marked = 2  
                                        
                                          
                                        def DrawMsg(self, x1, y1, x2, y2, msg) :  
                                      #Set Background Color  
                                      self.DrawSetPen(self.colors["background"])  
                                      self.DrawRectangle(x1, y1, x2, y2)  
                                      rHeight = self.rowheight  
                                        
                                      #Draw lighter areas  
                                      self.DrawSetPen(self.colors["lighter"])  
                                      for i in xrange(0, len(self.data), 2) :  
                                        if i == self.marked:  
                                         self.DrawSetPen(self.colors["marked"])  
                                         self.DrawRectangle(x1=0, y1 = rHeight*i, x2=x2, y2 = rHeight * (i+1))  
                                         if i == self.marked:  
                                          self.DrawSetPen(self.colors["lighter"])  
                                        
                                      #Draw darker areas  
                                      self.DrawSetPen(self.colors["darker"])  
                                      for i in xrange(0, len(self.data), 2) :  
                                        if i == self.marked:  
                                         self.DrawSetPen(self.colors["marked"])  
                                         self.DrawRectangle(x1=0, y1 = rHeight*i, x2=x2, y2 = rHeight * (i+1))  
                                         if i == self.marked:  
                                          self.DrawSetPen(self.colors["darker"])  
                                        
                                      #Draw self.data  
                                      self.DrawSetPen(self.colors["text"])  
                                      for i in xrange(len(self.data)) :  
                                        if i == self.marked:  
                                         self.DrawSetPen(self.colors["markedText"])  
                                      for j in xrange(self.data[i].GetLengthOfData()) :  
                                          if j >= len(self.columnwidth) :  
                                           width = self.columnwidth[-1]  
                                          else:   
                                           width = self.columnwidth[j]  
                                        
                                          itemToDraw = str(self.data[i].GetColumn(j))  
                                          self.DrawText(itemToDraw, x1 = x1 + j*width, y1 = i * rHeight + int((rHeight * .1)))  
                                      if i == self.marked:  
                                          self.DrawSetPen(self.colors["text"])  
                                        
                                      def GetMinimumHeight(self) :   
                                        return 200, self.minimumHeight()  
                                        
                                      def InputEven(self, msg) :  
                                      #x = msg(c4d.BFM_INPUT_X)  
                                        y = msg(c4d.BFM_INPUT_Y)  
                                        self.marked = int(y/self.rowheight)  
                                        self.ReDraw()  
                                        
                                        return True  
                                        
                                      class dlg(gui.GeDialog) :  
                                        def Init(self) :  
                                        pass  
                                        
                                        def CreateLayout(self) :  
                                      self.ua = MyUA(15, [ListViewData(("Name", "hello", 1002)) for i in range(20)])  
                                      ua_id = self.AddUserArea(100000121, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT)  
                                      self.AttachUserArea(self.ua, ua_id)  
                                        
                                      return True  
                                      d = dlg()  
                                      d.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, 1000124, -1, -1, 400, 300)
                                      

                                      There are no errors.
                                      But I don't get any text values. It's just black.

                                      -ScottA

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

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

                                        On 01/06/2011 at 08:35, xxxxxxxx wrote:

                                        First of all, please post such huge Code's on services like Pastebin.com.
                                        Then, take a look at your idnentation.

                                        GetMinimumHeight() and InputEven() are intendet a space to much.
                                        Also, it should be called InputEven t.
                                        Please use 4-space indentation. It makes the code much more cleaner and overviewable.
                                        Many editors support replacing automatically with a number of spaces, in Python's case it should be 4.

                                        In InputEvent you wanted to call the container, instead of use __getitem__ .
                                        y = msg(c4d.BFM_INPUT_Y) -> y = msg[c4d.BFM_INPUT_Y]

                                        You donÄt get any text, because the 2nd for-loop after the commend "Draw self.data" is wrong intended.

                                           for i in xrange(len(self.data)) :  
                                          if i == self.marked:  
                                           self.DrawSetPen(self.colors["markedText"])  
                                        for j in xrange(self.data[i].GetLengthOfData()) :  
                                            if j >= len(self.columnwidth) :  
                                             width = self.columnwidth[-1]  
                                            else:   
                                             width = self.columnwidth[j]
                                        

                                        should be

                                           for i in xrange(len(self.data)) :  
                                          if i == self.marked:  
                                           self.DrawSetPen(self.colors["markedText"])  
                                          for j in xrange(self.data[i].GetLengthOfData()) :  
                                            if j >= len(self.columnwidth) :  
                                             width = self.columnwidth[-1]  
                                            else:   
                                             width = self.columnwidth[j]
                                        

                                        Next, you don't see any coloured lines,because the drawing-clause is wrong intended.

                                           #Draw lighter areas  
                                        self.DrawSetPen(self.colors["lighter"])  
                                        for i in xrange(0, len(self.data), 2) :  
                                          if i == self.marked:  
                                           self.DrawSetPen(self.colors["marked"])  
                                           self.DrawRectangle(x1=0, y1 = rHeight*i, x2=x2, y2 = rHeight * (i+1))  
                                           if i == self.marked:  
                                            self.DrawSetPen(self.colors["lighter"])
                                        

                                        should be

                                           #Draw lighter areas  
                                        self.DrawSetPen(self.colors["lighter"])  
                                        for i in xrange(0, len(self.data), 2) :  
                                          if i == self.marked:  
                                           self.DrawSetPen(self.colors["marked"])  
                                          self.DrawRectangle(x1=0, y1 = rHeight*i, x2=x2, y2 = rHeight * (i+1))  
                                          if i == self.marked:  
                                            self.DrawSetPen(self.colors["lighter"])
                                        

                                        While drawing the Darker areas, you chose a wrong startingvalue within the xrange function.
                                        It should be 1, not 0 like when drawing the lighter areas.

                                           #Draw darker areas  
                                        self.DrawSetPen(self.colors["darker"])  
                                        for i in xrange(0, len(self.data), 2) :  
                                          pass
                                        

                                        should be

                                           #Draw darker areas  
                                        self.DrawSetPen(self.colors["darker"])  
                                        for i in xrange(1, len(self.data), 2) :
                                        

                                        Now it should work.
                                        You also messed up the colors.

                                          colors = {  
                                                  "background": c4d.Vector(.2),  
                                                  "lighter": c4d.Vector(.6),  
                                                  "darker": c4d.Vector(.8, .4, .2),  
                                                  "marked": c4d.Vector(.2),   
                                                  "text": c4d.Vector(.1),  
                                                  "markedText": c4d.Vector(.7, .5, .6),  
                                                 }
                                        

                                        should be

                                          colors = {  
                                                  "background": c4d.Vector(.2),  
                                                  "lighter": c4d.Vector(.6),  
                                                  "darker": c4d.Vector(.2),  
                                                  "marked": c4d.Vector(.8, .4, .2),   
                                                  "text": c4d.Vector(.1),  
                                                  "markedText": c4d.Vector(.7, .5, .6),  
                                                 }
                                        

                                        The full working code is here.

                                        cheers

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

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

                                          On 01/06/2011 at 08:59, xxxxxxxx wrote:

                                          It was rather difficult to copy the code from your video. It's a long one.
                                          Thanks for posting the code.

                                          Now I just need to go through it and see If I can figure out how it all works.
                                          Then try to do it in C++.

                                          Thanks,
                                          -ScottA

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

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

                                            On 02/06/2011 at 01:32, xxxxxxxx wrote:

                                            Np. 😉

                                            A preview of the Description Editor.

                                            There are still many bugs. It's just that you can see what it will look like. 🙂
                                            Cheers,

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