Set AddEditNumberArrows from .XML

On 18/07/2017 at 06:20, xxxxxxxx wrote:

Cinema 4D Version:   18
Platform:    PC  ;  
Language(s) :     Phyton ;

Hi Guys, 
Its been a while I have post anything.

Okay I made a example plugin that save and load UI data with .xml file that you can download.
but UI element which is AddEditNumberArrows. I can get the data from it.
And load it back by using a SetSting() that is show below and it works.

            # Load  Start and End of the AddEditNumberArrows
            LoadStartData = data.get('Start')
            self.SetString(GetStart_ID, LoadStartData)
            LoadEndData = data.get('End')
            self.SetString(GetEnd_ID, LoadEndData)

Now you will see number you save to the xml in the UI element when you load it. But it don't really set to the UI its False. Cause when I move the Arrows set to 1 or 0. Look at this example gif below.

Now I understand that I use SetString() but basically it not a string UI element.
Then I use a SetLong() and SetReal() and I get this error.

I'm still lost so I y'all you can help me. 
Plus even tho I been doing plugins for 2 years I am still a noob to plugin dev in C4D, I am still learning.

To download the free example plugin .pyp I made, so you can look at the full code:
https://drive.google.com/file/d/0B8yViI6dOLATVVZOVmRyX2tURFk/view

Any help or tips will be appreciated,
Cheers,
AP Ashton

On 18/07/2017 at 06:26, xxxxxxxx wrote:

YOu use SetString instead of SetFloat/SetInt32 etc...

On 18/07/2017 at 06:48, xxxxxxxx wrote:

I try that gr4ph0s, but still didn't work.
I try SetFloat:

            LoadStartData = data.get('Start')
            self.SetFloat(GetStart_ID, LoadStartData)
            LoadEndData = data.get('End')
            self.SetFloat(GetEnd_ID, LoadEndData)

Error:

I try SetInt32:

            LoadStartData = data.get('Start')
            self.SetInt32(GetStart_ID, LoadStartData)
            LoadEndData = data.get('End')
            self.SetInt32(GetEnd_ID, LoadEndData)

Error:

😢

On 18/07/2017 at 08:44, xxxxxxxx wrote:

import c4d
  
  
class mainDialog(c4d.gui.GeDialog) :
    def CreateLayout(self) :
        self.AddEditNumberArrows(1001, c4d.BFH_CENTER)
        self.AddButton(1002, c4d.BFH_CENTER, name="set_value")
        return True
    
    def Command(self, id, msg) :
        if id == 1002:
            self.SetInt32(1001, 10)
            
        return True
        
        
  
def main() :
    main_dlg = mainDialog()
    main_dlg.Open(dlgtype=c4d.DLG_TYPE_MODAL, defaultw=300, defaulth=150, xpos=-1, ypos=-1)
  
if __name__=='__main__':
    main()

Then it's your input since you read it as string make an explicit conversion to string with int(LoadEndData)

On 18/07/2017 at 13:07, xxxxxxxx wrote:

Thanks gr4ph0s 👏
lol my brain is slow lol I dont know why I did not think about that  
The code look like this now:

            # Load  Start and End of the AddEditNumberArrows
            LoadStartData = data.get('Start')
            self.SetInt32(GetStart_ID, int(LoadStartData))
            LoadEndData = data.get('End')
            self.SetInt32(GetEnd_ID, int(LoadEndData))

Thanks 🙂