Preview window flashing

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Preview window flashing

Post by rrTea »

In my project I have lots of models that are meant to stay briefly on the screen and then expire, for example various explosions, item pickup notifications, score indicators and similar. All these items have a same base model that is set to remove itself when its timer reaches 1, very simple stuff like this:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <Content>
    <Model Name="m_Base">
      <Definitions>
        <Variable Name="timer_Expire"/>
      </Definitions>
      <OnUpdate>
        <Condition Expression="return (timer_Expire);">
          <OnTrue>
            <RemoveModel/>
          </OnTrue>
        </Condition>
      </OnUpdate>
    </Model>
    <Model Name="m_Explosion" BaseModel="m_Base">
      <OnUpdate>
        <AnimatorSimple Duration="1" AutoStart="255" ToValue="1"/>
      </OnUpdate>
      <OnRender>
        <Condition Expression="return (timer_Expire&gt;0.2 &amp;&amp; timer_Expire&lt;0.7);">
          <OnTrue>
            <UseMaterial/>
            <RenderNet/>
          </OnTrue>
        </Condition>
      </OnRender>
    </Model>
    <Material Name="Material1"/>
  </Content>
</ZApplication>
The problem is that many of these "perishable effect" type of models have minor adjustments in the OnRender step which depend on the timer that is defined in base model, so as soon as a model of that type is selected, the preview window starts flashing and an access violation is reported in the console. In the example above, simply click on the m_Explosion model in the Project Tree to see the effect.

This might look like just a minor nuisance in this particular code above, but some models "flash" more than others and this makes it unpleasant to work. Anyway I am not sure this is happening to anybody else other then my computer & me, so just to show what I'm talking about here is a recording.
2020-05-31 08-34-30.zip
Flashing video.
(777.78 KiB) Downloaded 310 times
So are such components meant to always be kept disabled in the Project Tree? (I assume I am not expected to always make a local copy of the timer variable in base model ;) ) But then I can't live preview RenderParticle effect :)
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Preview window flashing

Post by VilleK »

Indeed this is a problem with models that has a base-model: they can only work correctly when they are cloned. And when previewing in the project tree they are not clones, they are the original.

Not sure what is the best solution, but at least I've fixed the flashing in this build: http://www.zgameeditor.org/files/ZGameEditor_beta.zip
(this also fixes the problem with first character missing in expression edit boxes)
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Preview window flashing

Post by rrTea »

Excellent, it's not flashing anymore! btw I can't really say for sure but I think there is/was a correlation between this and ZGE becoming unstable over time (and ultimately crashing) during longer working sessions… Well in any case thanks, this'll make it easier to adjust all those special effects and similar models!
Post Reply