Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Groups within Groups within Snapshots?
Started by playthisstudios Sep 04 2014 08:33 PM

17 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

playthisstudios

[GLOBAL: userInfoPane.html]
playthisstudios
  • Enthusiast

  • 71 posts
  • Corona SDK

Just wondering if I am having a brain fade or if there is an issue with having a group within a group in a snapshot? I have made a very simple example to illustrate (came from a much more complex app). The small white box should move across the full width of the larger red box (the snapshot), but when it gets half way across it dissapears!

 

Code below and main.lua attached.

 

Any help would be much appreciated!

 

David

--1st group
local mGroup = display.newGroup()
-- 2nd group
local tGroup = display.newGroup()
-- snapshot
local snap = display.newSnapshot(200, 200)
snap.x = 160
snap.y = 100

--Snapshot Background Rect
local bg = display.newRect(0,0,200,200)
bg:setFillColor(1,0,0,0.5)
snap.group:insert(bg)

--Test Obj
local testObj = display.newRect (120,0,10,10)
mGroup:insert(testObj)
tGroup:insert (mGroup)
snap.group:insert(tGroup)
snap:invalidate()

local function transTest()
	mGroup.x = mGroup.x - 1
	snap:invalidate()
end

timer.performWithDelay(20, transTest, 200)


[TOPIC: post.html]
#2

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @playthisstudios,

I suggest that you check your positioning and coordinates very carefully. There's likely some issue where you're placing groups with their "anchor points" where they shouldn't be, or something like that.

 

Brent



[TOPIC: post.html]
#3

playthisstudios

[GLOBAL: userInfoPane.html]
playthisstudios
  • Enthusiast

  • 71 posts
  • Corona SDK

Thanks for the reply Brent.

 

How would anchor point positioning result in the "white dot" disappearing completely out of the snapshot? Groups have no size, so if it is fine until it gets halfway across the snapshot, I am not seeing how that can be anchor point related?

 

It almost looks like it is getting "off screen" culled - is that possible within a snapshot situation?

 

D



[TOPIC: post.html]
#4

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @playthisstudios,

I tested a bit more, and there does seem to be an issue with multiple nested groups inside a snapshot. If I reduce your code to use just one display group inside the snapshot, and add the white dot to that group, everything seems fine. When nesting all of this within yet another group, things start to get weird. I'm not sure what the reason is for this, unfortunately. Is there any workaround for this nested structure in your design?

 

Brent



[TOPIC: post.html]
#5

playthisstudios

[GLOBAL: userInfoPane.html]
playthisstudios
  • Enthusiast

  • 71 posts
  • Corona SDK

Thanks Brent, at least I am not going crazy.

 

I can try a workaround, but it will be much more difficult (if it works at all). Do you think you can run this past engineering and get their thoughts?

 

Thx

 



[TOPIC: post.html]
#6

dwallin335

[GLOBAL: userInfoPane.html]
dwallin335
  • Observer

  • 6 posts
  • Corona SDK

Just noting that I am also running into this issue and not doing nested groups is not going to be possible for me. I spent a few hours trying to figure out what's going on, but there doesn't seem to be anything I can do to fix this. Could we maybe get this issue added to some official bug list?



[TOPIC: post.html]
#7

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @dwallin335,

Can you please submit a bug report, including a basic code/project which shows the issue occurring? This is how the engineers can track bugs and resolve them.

 

http://developer.coronalabs.com/content/bug-submission

 

Thanks,

Brent



[TOPIC: post.html]
#8

dwallin335

[GLOBAL: userInfoPane.html]
dwallin335
  • Observer

  • 6 posts
  • Corona SDK

Ok, I made an example project and attached it to the bug report.



[TOPIC: post.html]
#9

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,253 posts
  • Enterprise

Please post the bug report number that you got in the email for a reference.

 

Rob



[TOPIC: post.html]
#10

dwallin335

[GLOBAL: userInfoPane.html]
dwallin335
  • Observer

  • 6 posts
  • Corona SDK

Sure, it's case 37556

 

For reference, here's what I'm seeing.

 

Expected:

 

bTDaIaG.jpg

 

Actual:

 

UD0ZTfV.jpg

 

Seems like the snapshot is culling all the images that fall above or to the left of the center point of the snapshot (ie, < 0.0 on the x or y axis).



[TOPIC: post.html]
#11

tap32

[GLOBAL: userInfoPane.html]
tap32
  • Contributor

  • 231 posts
  • Corona SDK

I'm having the same issue! It will certainly be disruptive, can it be made a priority?

[TOPIC: post.html]
#12

tap32

[GLOBAL: userInfoPane.html]
tap32
  • Contributor

  • 231 posts
  • Corona SDK

Also thanks David and dwallin335 for posting - I've spent most of the day trying to figure out why on earth things are disappearing for no reason!

[TOPIC: post.html]
#13

TheRealTonyK

[GLOBAL: userInfoPane.html]
TheRealTonyK
  • Contributor

  • 335 posts
  • Corona SDK

Also experiencing this issue... Groups within Groups within snapshot...

 

I was actually able to achieve a solid snapshot cache utilizing Groups within Groups (even within Groups) but requesting a snapshot object twice the size as necessary.

 

After utilizing this multiplier, the path coordinates (x,y) do not seem to be transforming correctly.  I can exaggerate the values to achieve a transform, but something appears off here.  Still testing to see if I can come up with something that looks mathematical...

 

Ah... after removing my groups border mask, i can see my group stack is sitting in the bottom right corner of the multiplied snapshot... hmmm



[TOPIC: post.html]
#14

PXL artificer

[GLOBAL: userInfoPane.html]
PXL artificer
  • Contributor

  • 311 posts
  • Corona SDK

Same problem here. I "solved" reducing the nesting groups, but it's not very convenient.

Any news on fixing this issue?



[TOPIC: post.html]
#15

jeremytm

[GLOBAL: userInfoPane.html]
jeremytm
  • Observer

  • 8 posts
  • Corona SDK

+1 I can confirm this.

 

I'm creating a snapshot the full size of the screen (to save on processing of static objects and groups for a level background).

 

If I try and position the inserted group so the it anchors at the center of the snapshot viewport/mask, any sub-objects top-left, top-right, and bottom-left quadrants of the snapshot are culled.

 

Setting the size of the snapshot to allow for double the width and height that I need, then positioning everything in the bottom right quadrant is a decent workaround, until you get to iPhone 6+, which because of it's screen size in raw pixels requires a snapshot larger than 4096 pixels on the y-axis, so it breaks.

 

It's also impossible to change the origin of snapshots to be anything but the center. See this poor ignored soul: http://forums.coronalabs.com/topic/46265-snapshots-created-with-half-the-size-passed-to-newsnapshot/

 

The ability to create snapshots, that work... would be amazing!



[TOPIC: post.html]
#16

jeremytm

[GLOBAL: userInfoPane.html]
jeremytm
  • Observer

  • 8 posts
  • Corona SDK

I've added some drop-in code which fixes this by extending display.newSnapshot to process any nested groups inserted into the group, and flatten them into a single layer. You don't have to do anything but drop the code into your project, preferably in some sort of fixes.lua file which you call before anything else.

 

Find it here.

http://code.coronalabs.com/code/snapshot-fixes

 

It works for me, if you have any issues let me know via Github.



[TOPIC: post.html]
#17

dwallin335

[GLOBAL: userInfoPane.html]
dwallin335
  • Observer

  • 6 posts
  • Corona SDK

FYI, got a note saying this will be fixed!

 

"This will be fixed in daily build 2599 or after."
 



[TOPIC: post.html]
#18

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Yes, I can confirm that this issue was investigated and it will be fixed. Thanks for your patience everybody.

 

Brent




[topic_controls]
[/topic_controls]