ah yes the devil is indeed in the detail well
yes unfortunatly its so complicated that its
hard to simplify easily,
and I need it to cope with any posible combination of devils.
the main diferences are that :-
most of the stuff I need to edit is custom data fields
that are implemented via a dictionary<fieldname,dataContainer>
this is actualy working ok, the data container describes the data and
includes
the data and links to next fields and lists of subfields etc.
it may include all maner of custom data structures
I simply use a facade wich can handle anything via reflection even
structures
in libraries. you helped me get this far before thanks.
However the problem comes when those structures I dont have access to
are in collections. I now seem to be able to solve this using the
AddProvider.
struct surface
{
Directx.Vector3 Origin,Normal,...
}
class/struct Poly
{
Surface surface; //texture offset etc.
Directx.Vector3[] Vectors;
}
class Polys
{
Directx.Vector3 Base;
EPolyFlags PolyFlags;
Poly[] Polygons;
}
class Model
{
Polys[] PolyList;
}
this is drasticaly simplified, theres maybe some 100k name tokens
involved in all, obviously not all is a data field description.
both poly and polys are semi custom defined,
and I think the create instance would be far to complicated to implement
to cope with all situations, and I dont expose all the data fields via
properties.
however the pop up colection editor copes fine at least with
the Vector array, I assume this is doing its own create instance?
it alows me to re size an array of structs,
so i assume its resizing the array, and copying the items
and then writing the new aray back to the parent.
I could do this myself, I have found the instance which is the actuall
collection,
or array, but I dont seem to have an indictaion of what the index is.
some things are obviously too dangerous to edit,
and Im happy as long as I can let the user edit certain things
like the Vertexes and the various flags. but wich just hapen to be in an
array of library structs.
Its just irking me that the pop up editor works ok for the vertexes,
but not when they are expanded in the property editor itself.
the application is a game editor, the game is unreal,
there are many diferent versions, and the game uses its own script.
some of the above structs are defined in the file,
I have to implement some of the structs in c# as there
are so many vertexes for instance it would be too slow otherwise,
particularly the ones above.
some of the things I need to alow the user
to do in the property editor are fine tune some vertexes etc.
problems come when models are made wich are snaped to a grid, then
rotated etc, and dont quite meet up and this cuases holes wich can
cuase players to fall out of the world.
obviously the more involved graphical editing is done with something better
than property grid.
although I could and do use my own struct for Vector,
at some stage this is pased to directx or some other graphics library,
and the property editor picks up whatever object is beneath the mouse
on the 3d view, wich inevitably involves some directx structs
for wich I cant edit the code obviously.
My main problem is I get so lost looking through all the
classes involved and trying to work out what does what where and when.
il look up UITypeEditor you mentioned.
some of the samples I find it so hard to find the parts
that are involved in the functionality I want to do.
plus ofc im heavily involved in the graphics wich
seems hard to find solutions for some of the simplest of things,
and converting the game file format, hopefully
I can make progrees on some actual usefull
editing features soon.
many thanks
Colin =^.^=
"Marc Gravell" <ma**********@gmail.comwrote in message
news:f7**********************************@f36g2000 hsa.googlegroups.com...
Re editing items in the property editor, the main tools here are
TypeConverter and UITypeEditor - you usually don't need custom
PropertyDescriptor provision.
Again - the setup is foreign, an unfortunately the devil is in the
detail with these things. Is there a way we can sketch this out with
very simple code?
As a starter for 10; is the setup anything like:
[TypeConverter(typeof(ExpandableObjectConverter))]
class Foo {
public string Name {get;set;}
}
[TypeConverter(typeof(ExpandableObjectConverter))]
class Bar {
private readonly List<Foofoos = new List<Foo>();
public List<FooFoos {get {return foos;}}
public DateTime DateOfBirth {get;set;}
}
And then what? What is the core thing we are trying to do? What do we
want to behave differently to just throwing that (Bar) at a
PropertyGrid?
[even if you can just talk me through it, it would really help me give
a sensible answer]
Marc