Adam's Lair Forum

game development and casual madness
It is currently 2019/11/17, 01:56

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 2015/12/17, 20:01 
Newbie
Newbie

Joined: 2015/12/17, 19:26
Posts: 3
Location: France
Role: Hobbyist
Hi there !

My first post in this forum to ask for something I've found very cool :D, but not able to reproduce :S ...

Well, first, I've seen that the Angle property of the Transform object appears with a thin scroll bar under the numeric value. This scroll bar, if I can call it like that, changes the value from 0 to 360 degrees, which is very fast and easy to use. Very cool, as I said at the begining, but... the Advisor says "The objects angle / rotation, in radians." So, I decided to scroll again, and yes, I'm sure that the numeric value is in degrees and not in radians. OK, no problem, degrees are easier to use in the UI than radians, and inside code, radians are more convinient, that's why this conception choice has been done !

Now, I want to expose in my component a BezierCurve struct of mine as a property. Maybe there is another way (better way ?) to do the curve parameters, but in my design, the struct contains two Angle properties. I'd like to be able to have the same design as the Angle property of the Transform object, and I don't understand how I can achieve the degrees / radians trick. I've found the EditorHintRangeAttribute to make the little scroll bar appears, and it works well but my value is still in radians and I'd like to show it as degrees...

I'm aware that it's not a big deal, but I'm always feeling very concern by design-time things.

Thanks for your answers ! :)

PS : I'm French :redface:, so please, stay cool about my English, I do my best !


Top
 Profile  
 
PostPosted: 2015/12/18, 11:13 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
Hey! :)

I'm a bit short on time, so I'll make this quick: The custom conversion from radians to degrees for the Angle editor in the Transform part of the Object Inspector is done in the custom PropertyEditor implementation of the Transform Component. You can do something like this yourself, but that'll require you to set up a custom Editor Plugin and has a bit of overhead. Right now, there's no way to specify a conversion operation like this from within the Core Plugin itself.

The Transform editor and even only its Angle editor does a lot of other custom stuff as well, so you certainly won't have to write that much code. Still, nothing that can be done (yet?) with just adding some attribute in the core.

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
PostPosted: 2015/12/18, 13:05 
Newbie
Newbie

Joined: 2015/12/17, 19:26
Posts: 3
Location: France
Role: Hobbyist
Thank you for quick answer !

Adam wrote:
Right now, there's no way to specify a conversion operation like this from within the Core Plugin itself.
OK I understand, and honestly, I didn't expect to develop an editor plugin. At least, not now... So, while I'm still a newbie with your great tool, I just close my eyes on this part for the moment.

After that, from what I see by now, be able to customize properties in a "PropertyGrid style" could require less code to produce for that purpose I guess. I didn't fully analyse the TransformPropertyEditor class code you provide, but it seems to me that some mechanism already exist in the .Net Framework. I mean TypeConverter and UITypeEditor with their attributes over classes or properties for instance allow coders to customize properties display or behaviour almost directly from their declaration.

Anyway, the work you've done is very cool ! ;) When my game development skill level will be good enough, I'll take a closer and much detailed look at your design-time customization part. Maybe I'll propose something to you for the 3.0 B)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group