ratalaika / angel-engine

Automatically exported from code.google.com/p/angel-engine
0 stars 0 forks source link

Renderables which are deferred adds to world are never assigned requested name #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello!  Another bug for you (and better yet, a fix too! ;))

If a renderable is a deferred add to the world, it runs through the Add() 
function twice.  Each time, it checks the name of the renderable.  Thus, 
deferred adds will never receive the requested name (and worse, will actually 
change names between construction and the next frame, which is how I found this 
one)

So, this patch adds a check to see if the renderable is in the deferred queue.  
I've introduced a helper function to check to see if a given renderable is in 
the deferred queue.

Hope this helps!

-- Sim

Original issue reported on code.google.com by Sim9OLDA...@gmail.com on 13 Jul 2010 at 4:25

Attachments:

GoogleCodeExporter commented 9 years ago
Hmmm. I'm wondering if it wouldn't be better to just make sure the name is only 
getting set if _elementsLocked is false, rather than cycling through every 
Renderable on every Add. 

In that case, the name might still change between Add and a time you care to 
retrieve it. I'm more liable to add a piece of data to the Actor, or something 
to the World to put it in a mode so that it knows it's processing the deferred 
adds and shouldn't attempt to rename. 

Original comment by lieseg...@gmail.com on 13 Jul 2010 at 1:44

GoogleCodeExporter commented 9 years ago
Does this patch also solve the problem? Checking a bool is going to be a lot 
quicker that iterating over all potentially deferred adds, especially if a game 
is starting up with lots of actors. 

Original comment by lieseg...@gmail.com on 13 Jul 2010 at 2:31

Attachments:

GoogleCodeExporter commented 9 years ago
This looks like it should work fine (and be much more performant as well!)

TortoiseMerge has been fighting me tooth and nail this morning to actually 
apply the patch for some reason.  Tonight I'll find another merge utility or 
apply it manually and report back as to how it works.

Original comment by Sim9OLDA...@gmail.com on 13 Jul 2010 at 3:51

GoogleCodeExporter commented 9 years ago
Your DeferredCheck patch is working great on my project, thanks!

Original comment by Sim9OLDA...@gmail.com on 14 Jul 2010 at 2:24

GoogleCodeExporter commented 9 years ago
Fixed in trunk. 

Original comment by lieseg...@gmail.com on 14 Jul 2010 at 2:48