Re: Beginning to extend csVariantType
Andrei Bârsan <[email protected]>
| Newsgroups | gmane.comp.graphics.crystalspace.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello Christian,
Thank you so much for the highly detailed response. I feel on the right
track now!
> Maybe we can use additional interfaces to define specific structures of
> iModifiable objects.
>
> For example for a list, we would define an additional interface
> iModifiableList like this:
>
> struct iModifiableList : public virtual iBase
> {
> size_t Push (iModifiable* modifiable);
> bool Insert (size_t index, iModifiable* modifiable);
> size_t GetCount () const;
> size_t GetIndex (iModifiable* modifiable) const;
> bool Delete (size_t index);
> bool Delete (iModifiable* modifiable);
> }
>
> And an object willing to be structured like a list would implement that
> interface.
>
> Similarily, we can define interfaces for a process:
>
> struct iModifiableProcess : public virtual iBase
> {
> iModifiable* GetInput ();
> iModifiable* GetOutput ();
> }
>
> And for a tree node:
>
> struct iModifiableNode : public virtual iBase
> {
> void SetParent (iModifiable* parent);
> iModifiable* GetParent ();
>
> void SetChild (size_t index, iModifiable* child);
> iModifiable* GetChild (size_t index);
> size_t GetChildrenCount () const;
> void RemoveChild (size_t index);
> }
Okay, noted. However there is one practical aspect that I still haven't
really figured out. An object could implement iModifiableList, and it
would be displayed as a collapsible list. But where? Maybe in another
iModifiable object that has the iModifiableList object as a member. But
I don't think this would be flexible. You said "an Object willing to be
structured like a list". But where? When its parent were to be edited?
It wouldn't really make sense to use this property, unless the
iModifiableList object is part of a bigger iModifiable object, right?
What about writing something that can simply expose an iModifiable iNode
of an iModifiable object, and automatically display it as a list.
> An iBase should be constrained by a iModifiableConstraintEnum that will
> let you build a combo box holding all the possible values. A callback
> mechanism should also be added to the iModifiableConstraintEnum in order
> to be able to update the enum list.
>
> If the iBase has no constraint, then you simply don't display it in the GUI.
Okay, got it.
> A iModifiable is already some sort of more generic key-value structure,
> associating a csStringID to a csVariant. Therefore, we may not need an
> additional variant type for iKeyValuePair.
>
> And a key-value list can be represented either by a single iModifiable or
> by a iModifiableList, therefore we may not need additional structures for
> both KeyVal's and KeyValList's
I've commented those things out, and take them out completely in the
future if the situation doesn't call for a re-integration.
> A matrix 3 can be represented eg by three rows with 3 text fields. But I
> doubt that this can be really helpful for any 'normal' human being to try
> to edit directly those values, therefore such a GUI tool wouldn't be that
> helpful.
>
> But if we consider that matrix3 will only be used for rotations, then we
> can use another representation. Euler angles are probably the only ones
> that can be really manageable by a human being, although they suffer from
> several problems such as gimbal lock. Maybe use them and put the three
> values for the Euler angles in three text fields on the same line, or
> separated by a ';'. And internally, the Euler angles are converted into a
> csMatrix3.
>
> Mmm, actually, maybe we can remove the 'matrix3' type, and only use
> quaternions.
> (transforms)
> You can represent it by two rows: one with the Euler angles, the other
> with the offset. And internally, you convert it to a csTransform.
>
> Or: we remove the 'transform' variant type, and we let the user having to
> define two parameters for the rotation and the offset. Probably better.
>
> In all cases, transforms and rotation matrices can be accompanied in the
> editor by another GUI tool based eg on a mouse interaction (Jorrit has
> already some code for that in AresEd). The user would therefore be able to
> manipulate either directly the explicit values or through a mouse
> interaction.
Well we shouldn't throw out the directly editable parameters anyway.
I'll go and implement a simple panel consisting of euler angles + offset
for the transform node, as it shouldn't be too much trouble.
> You don't need the cseditor to test the iModifiable. Your test application
> should be self-contained, implementing by itself some instances of a
> iModifiable that are interesting for the purpose of the test application.
>
> I'm still working on the cseditor although I'm very busy with other things
> these days. Hopefully I will have finished in a few days, by the same time
> that you finished the iModifiable stuff.
>
> And there are much probably still a lot of work that can be done on the
> iModifiable before that: adding all types, adding lists, adding callback
> mechanisms, adding translations, etc.
Okay, I'll just add a canvas-style panel where stuff will be able to get
rendered (perhaps I can still look at some of the editor code for
inspiration). But only when the rest of the stuff is in place, anyway.
> Yes, there are several issues with the slider that I've never talked
> about, sorry about that:
> - The code has been taken from some other project which was GPL. You
> should therefore rewrite the whole code and you don't unfortunately have
> the right to cut& paste a single line from the original code (otherwise
> we need to put your code in GPL too).
> - There is the issue you mention with the focus. It is not clear how this
> problem can be solved.
> - Side note: the slider is not only for float's, it should manage int's too.
Alright, but before re-making it, isn't the wxWidgets built-in slider
any good? (wxSlider) I think there might be a good reason for it, but I
just can't seem to see it.
Regards,
Andrei Bârsan
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/