Maintaining alpha-value in editor.

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Maintaining alpha-value in editor.

Post by jph_wacheski »

I have noticed that when using the editors right-click-to-set-alpha-value on a colour,. that it works great, till you change the color. Then the alpha-value is reset to 1. Could this be changed so that the alpha value is maintained when tweeking the colour? I do realise I could just type the alpha in an expresion and be done with it,. however it is much more convienent simply using the editor interface.
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Implemented. :P
DesignerGui, near line 540

Code: Select all

var
  ColorDialog : TColorDialog;

procedure TZPropertyColorEdit.OnClick(Sender: TObject);
begin
  if ColorDialog=nil then
    ColorDialog := TColorDialog.Create(Application);
  ColorDialog.Color := ZColorToColor( Value.ColorfValue );
  ColorDialog.Options := [cdFullOpen];
  if ColorDialog.Execute then
  begin
    Value.ColorfValue := ColorToZColor(ColorDialog.Color);
    UpdateProp;
    ValuePanel.Color := ColorDialog.Color;
  end;
end;
should be:

Code: Select all

var
  ColorDialog : TColorDialog;
  AlphaTemp : single;
procedure TZPropertyColorEdit.OnClick(Sender: TObject);
begin
  if ColorDialog=nil then
    ColorDialog := TColorDialog.Create(Application);
  ColorDialog.Color := ZColorToColor( Value.ColorfValue );
  ColorDialog.Options := [cdFullOpen];
  if ColorDialog.Execute then
  begin
    AlphaTemp := Value.ColorfValue.V[3];
    Value.ColorfValue := ColorToZColor(ColorDialog.Color);
    Value.ColorfValue.V[3] := AlphaTemp;
    UpdateProp;
    ValuePanel.Color := ColorDialog.Color;
  end;
end;
Maybe Ville will include it :)
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Hay thats cool you found and remided it! I'm sure if it works and creates no additional problems that it will get included..,

Ok, here is another small thing that has been bugging me with the editor;

When editing a ZExpression,. if I navigate away from the expression, by first clicking on and expanding or collapsing a sepaerate part of the component tree, the changes to the expression are lost. This does not happen if I simply navigate to a seperate component, in that case the changes are saved properly. I am not sure if any other 'moves' cause this but I have nerrowed this annoiyng little querk down to that,. any ideas? I loose a lot of time retyping stuff currently,. as I often forget to hit TAB or click OK.
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

mmm I don't like the idea of a window like "save changes?" but I think we can add something like a global option: "Auto-save modifications to ZExpressions". If you agree doing something like that, yes I think we can make it working, maybe using a the loss of the focus as a trigger.
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

I am not sure what you are saying here kattle? The editor already saves the changes to the window when you leave it,. only it forgets to do so if you first open any other part of the component tree,. by pressing on any of the small + [plus signs] or clicking on the heading. I think it is just an oversight,. . not sure.
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Actually, it seems to me that changes to the ZExpressions are saved _only_ if the OK button is pressed, and they are discarded when you leave the ZExpression... And it should be so for "design" reasons. Just tell me again what you mean, I might understand better :)
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Well just try it! If'n you type in an expression and then click on any other currenly displayed component in the tree, the change is saved,. even if you never pressed Tab or the Ok button. If however you click on one of the + or - icons or the names of other tree elements then click on one of those componenets the info you changed is lost,. . this is a frustration to me as often I change some code then move on,. and the changes are lost,. There is no editor design that I can think of that mandates the lost of the change,. why would that be a good idea,. if I chaged the data, I intend it to be changed, no?
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Yesterday it worked in a different way for me!!! Today I understood what you meant.

There are some "random" bugs still hidden in the editor I think
:evil: We must shoot 'em all :evil:
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

That alpha-fix looks good Kjell, you can check it in to the Subversion repository if you want to.
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

kjell??? :P :D
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Haha, sorry I thought it was Kjell :) I read it too quickly. Good to see you're up to speed with the code too kattle!
I blame the mistake on the heat here in stockholm at the moment.
Post Reply