DescEdit (Descriptionfiles Editor)
-
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 ? -
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.
-
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 hereEdit:
Oh spotted an issue in the Group-Dialog. Of course the type does not have to be defined. -
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
-
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
-
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.
-
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
-
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, -
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
-
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
-
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 -
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, -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/06/2011 at 06:28, xxxxxxxx wrote:
I didn't want to make the whole video again, only because at the end of all an error occures because of a missing import in the DescEdit Example Object.
But instead of that, everything worked fine.
Give me some feedback, please.DescEdit Example - The first step to the output
Cheers,
Niklas -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/06/2011 at 12:56, xxxxxxxx wrote:
Hi Niklas,
I've had a look at the video now. It's coming along nicely. It looks as though you've finished the basic code for writing the various files in the correct format - which would be a real timesaver in itself.
It's still not as user-friendly as I'm sure you're intending to make it. For example, when defining the container object, why not have a drop-down list of possible includes rather than typing it in? Or, for a REAL element, you could let the user choose various options from a list, like the unit to be used.
But I'm sure you're working on all that, so carry on and I think a lot of us would use the final version.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 20:03, xxxxxxxx wrote:
Thanks spedler !
I first want to make it wokr in generall. Fine things can be added later.The GUI now has been finished! After rewriting the whole ...
Here's the latest preview! (With me speaking, don't laugh about my englisch )I now have to work over ther DescFile Generation Process once again, because it's less comfortable than I had imagined.
Any Idea how i coul implement reopening of the files ?
I don't want to write a ressource-parser O.o
I'm thinking about my own Project fileformat for this.Cheers,
Niklas//EDIT
DOOH ! I forgot to implement Groups under Groups !! :OO
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2011 at 01:49, xxxxxxxx wrote:
Looking pretty good. I've no other comments about the GUI to add to my previous ones.
WRT to saving/loading your files, I think this depends on how you've structured the data you have for the resource. The resource is basically a linked list so you need some way to handle child elements, siblings, and so on. Presumably you already do this - did you subclass GeListNode or something?
If your data is structured like that then could you save it out as a binary file, just saving each element in turn? That would make it much easier to reload it.
BTW, your English is excellent. No one's going to laugh.
Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2011 at 07:05, xxxxxxxx wrote:
Thank you.
No, i didn't subclass GeListNode. (Is this possible ?)
I have classes for Group, Element, Cycle and CycleId
Group, Element and Cycle hold an list called subelements.
In the list can be again Groups, Elements, etc.
The output formatting is done recursively.Do you mean a file for every element ?
Thanks.
Ehm, do ou think one would really need the ID Parameter for an Element ?
Maybe it's not that important to be able to define some IDs yourself.Niklas
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2011 at 08:02, xxxxxxxx wrote:
I forgot you're writing in Python. In C++ it seemed to me that you could create a class based on an existing SDK class (purely for convenience - you could create your own instead) and use that to hold details of the various elements in the description. In Python you've got lists and tuples and things which make life a lot easier when managing lists of objects.
No, I didn't mean one file per element. I thought that you could create a file whose first parameter would hold the number of elements in the resource. Then you would save each data structure representing an element to the file, one after the other. On reloading you would just reload the required number of data structures.
However, to recreate the resource each element would have to point to its first child element (if any) and to its first sibling element. That's why I thought a linked list would be a handy way to manage the various elements, and since the SDK contains a class which is a linked list, you could maybe subclass that. But I don't know how it would work in Python using its built-in lists.
Anyway, just some thoughts.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2011 at 10:32, xxxxxxxx wrote:
Thanks for the suggestions.
I came to the conclusion that it would be easier to have an own fileformat.I've completed the raw code (that I have to rewrite next time because right now it is just holy crap !).
Best thing is that the chunksize is variable so the filessize won't bee tooooo large.
This is the raw file text.
I'm able to analyze this text. I will now implement recursive generation of the objects for the dialog.There are only a few bugs with the FileFormat formatting, i'll get them fixed too !
Cheers,
Niklas -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/06/2011 at 09:02, xxxxxxxx wrote:
Hei Guys !
I am proud to be able to tell you that Description Editor is almost finished !Here is just another Example to see it in action !
(I'm sorry for my speed with the mouse . Hope you get what's going on on the screen o.o )I hope you like it !
Cheers,
Niklas