On Sunday, September 22, 2013 10:02:07 PM UTC+2, Justin Israel wrote: > Why does the object need to be serialized to json? Can't you just store your > object as data directly? > > Also, you could subclass QTreeWidgetItem and store a custom item in the tree. > > On Sep 22, 2013 11:39 PM, "shapeofmotion" <[email protected]> wrote: > > Hi, > > First off thanks for a great forum! > > > > I am using the pyside QTreeWidget to create a basic ui to list which > materials and or SG that has a specific V-Ray material ID assigned to it. The > widget lists parent items with the shader ID as label and the child items are > the materials or SG that have that ID assigned. > > > > > I have assigned the name of the material to the data attr so that when the > item is clicked the material gets selected in the hypershade. As it works now > if I were to rename the material it would no longer work since the widget is > pointing to the name and not to the actual object. > > > > > I am sort of stuck here, my initial idea was to serialize a dict that was > pointing to the pyNode, but the JSON.dumps method is giving me errors that my > dict is not JSON serializable. > > > > I am pretty new to pyside and especially the qtreewidget so any tips, ideas > or pointers are very welcome! > > > > Thanks, Johan > > > > -- > > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > To post to this group, send email to [email protected]. > > For more options, visit https://groups.google.com/groups/opt_out.
As you pointed out the best way is obviously to store the object as a custom data type in the threewidgetitem. I am quite new to pyside and found the documentation (http://srinikom.github.io/pyside-docs/) on the subject a bit hard to grasp. Do you have any good tips on how to do this or can you point me to some information on the subject? Best regards, Johan -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
