My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 272: Create a BatchableElement class
2 people starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  ----

Sign in to add a comment
Reported by, Apr 17, 2008
There are 3 kinds of items that can be added to a batch. and at least
sprites and labels that have a different way of dealing with getting added
to a batch and group.

i think it could be a good idea to have a batchable that can suppport
assignement and re assignment to different batches or groups. also, the
ability to remove the vertex_list from a batch without destroying it.

In this way i can create new kind of things that can be added or removed
from the current batch in an uniform way, just subclassing from this. also,
sprite label and textlaout should inherit from this.

also, i usually dont know the batch ill add the element when im creating
it. so having a None batch and being able to define it later would be nice.

Apr 17, 2008
Project Member #1
I actually tried to create something like this and wasn't able to satisfactorily.  An
element can't create its vertex lists until it has a batch (or knows that it won't
get one).  Migrating vertex lists from one batch or group to another is hideously
expensive (by design -- this was never intended to be an important use-case), which
is why only Sprite currently supports it.

Is it really so hard to create the batch first, and then add elements to it?  Doing
it the other way around requires either a two-stage construction process (first
construct the object, then add it to the batch and create its vertex lists), or a
migration or recreation of vertex lists.

If you have a patch that implements this I'd be very interested to see it.  I'll keep
this request in mind, but I don't think it will make it into pyglet 1.1, as it's not
trivial (and, IMO, not necessary once you adapt to a certain style of writing).
Status: Accepted
Labels: Milestone-Intractable
Apr 17, 2008
Project Member #2
(No comment was entered for this change.)
Labels: -Type-Defect Type-Enhancement
Apr 17, 2008
Its not that creating the batch is hard, its just not the way i want to do it. In
cocos you create an object and then add it to a layer or sprite or scene or a
batchnode. if the object you add to is a batchnode(or descendant), the added abjects
batch and group elements are set so that z-order is respected and composition also (a
batchnode, with a sprite that has a sprite.. etc).

having to have the batch in hand before creating the nodes makes it very different as
how everything else is created and managed. it also makes you hand manage all the
groups stuff that now its set up automatically.

the way i can implement it is doing a two phase creation as you said, but of a cocos
element, that creates a new label when it needs one. but i was hoping people could
still use pyglets interfaces for drawing.
Sign in to add a comment

Powered by Google Project Hosting