hmm, thats a shame. If you feel like logging a bug, we can take a look at
this in more detail:

http://code.google.com/p/away3d/issues/list

cheers

Rob



On Tue, Feb 2, 2010 at 9:27 PM, Post Mesteren <[email protected]> wrote:

> Well unfortunately the theory is busted, and having to wait until the first
> render()
> before calling update() really messes up my class/object design...
>
> This is what I ended up doing to avoid having to hack the away3d sources;
> I extended MovieMaterial and overrode updateMaterial():
>
>
>        public override function updateMaterial(source:Object3D,
> view:View3D):void
>        {
>            var origAutoUpdate:Boolean = autoUpdate;
>            if (_renderBitmap == null) {
>                // Workaround for autoUpdate-false bug + update() before any
> renders
>                // See our post at
> http://groups.google.com/group/away3d-dev/browse_thread/thread/7a398d69cb860756
>                this.autoUpdate = true;
>            }
>            super.updateMaterial(source, view);
>            this.autoUpdate = origAutoUpdate;
>        }
>
> (Unfortunately "rendered" is private, not protected, so I had to check on
> _renderBitmap instead)
>
> On Tue, Feb 02, 2010 at 19:03:57 +0000, Rob Bateman wrote:
> > I would try leaving the MovieMaterial with autoUpdate = false - in theory
> > this should trigger update() once on view.render() and copy the contents
> to
> > _renderBitmap, then only again if you set autoUpdate to true or call
> update
> > manually. If this doesn't work, try setting autopUpdate to true by
> default,
> > then false after the first view.render(). should do the trick
> >
> > Rob
> >
> >
> > On Tue, Feb 2, 2010 at 1:50 PM, Post Mesteren <[email protected]>
> wrote:
> >
> > > Hello, I'm having issues with MovieMaterials with autoUpdate = false,
> > > especially wrt calling update() on the MovieMaterial instance before
> > > being rendered. I.e.,
> > >  1. Create a Sprite with some contents
> > >  2. Create a new MovieMaterial(contentSprite, {autoUpdate:false,
> > > transparent:false})
> > >  3. Assign material to some object but don't add the object to the
> scene
> > > yet
> > >  4. Call .update() on the moviematerial
> > >
> > > The material is rendered all black.
> > >
> > > I think this happens because the "movie" is only ever rendered by
> update()
> > > if the _renderBitmap is non-null, but it's null before any calls to
> > > view.render().
> > >
> > > What do you think about the following patch, which seems to make things
> > > work out nicely?
> > >
> > > Index: src/away3d/materials/MovieMaterial.as
> > > ===================================================================
> > > --- src/away3d/materials/MovieMaterial.as       (revision 2164)
> > > +++ src/away3d/materials/MovieMaterial.as       (working copy)
> > > @@ -158,7 +158,7 @@
> > >         {
> > >                super.updateMaterial(source, view);
> > >
> > > -               if (autoUpdate)
> > > +               if (autoUpdate || !rendered)
> > >                 update();
> > >
> > >             _session = source.session;
> > >
> > >
> >
>



-- 
Rob Bateman
Flash Development & Consultancy

[email protected]
www.infiniteturtles.co.uk
www.away3d.com

Reply via email to