Export AS3 class

Software: Prefab3D

meddlingwithfire, Newbie
Posted: 18 November 2012 02:20 AM   Total Posts: 5

I am trying to export a model that I have created in Blender for consumption within an Away3D app.  I exported the model from Blender to a Collada .dae format, but it seems that the either Blender is not exporting all of my data or the Away3D Loader3D class is not honoring all of the configurations that I made in Blender.  Notably, I built a symmetrical model in Blender (and thus used a mirroring configuration), but when I load the .dae into my scene, I only see half of my model. 

So I struck out and looked for other options.  I found that I can open up my .dae within Prefab and re-add the mirroring through the Geometry menu.  Sweet!  But then I try to export from Prefab as an AS3 class, and I am running into trouble; I am receiving build errors when I try to use the classes that Prefab generates for me:

Description Resource Path Location Type
1046: Type was not found or was not a compile-time constant: SinglePassMaterialBase. ASBase.as /Test/src/com/meddlingwithfire/test/models/prefab line 88 Flex Problem
1172: Definition away3d.materials:SinglePassMaterialBase could not be found. ASBase.as /Test/src/com/meddlingwithfire/test/models/prefab line 12 Flex Problem
1180: Call to a possibly undefined method SinglePassMaterialBase. ASBase.as /Test/src/com/meddlingwithfire/test/models/prefab line 97 Flex Problem

Is there a certain release of Away3D that Prefab is expecting?  Or am I performing the export incorrectly?  I am running the latest stable build (4.0.9 Gold) and Prefab Version 2.131.

On a side note - I expect to be exporting a slew of models in the future.  The AS3 export utility currently produces a bundle for each model.  In that bundle there are two classes that will never change regardless of what model I am exporting: ASBase.as and ASDReader.as.  Is there any plan on breaking out those two classes in the packaging system so that they wouldn’t get duplicated?  For the time being, I can break them out by hand, but it means that I have to manually fix some import statements post-export.  Not difficult, just time-consuming.

   

Avatar
Fabrice Closier, Administrator
Posted: 18 November 2012 11:56 AM   Total Posts: 1265   [ # 1 ]

The latest Prefab update let you choose the
engine version for the as3 exports, by default 4.1. Since you run 4.0,
You need to select 4.0 from dropdown.

Several new export options will be added soon, one
of them will adress the duplication problem.

   

meddlingwithfire, Newbie
Posted: 18 November 2012 11:35 PM   Total Posts: 5   [ # 2 ]

Thanks Frabrice!  I can’t believe I missed that menu drop-down!  Sure enough, there it is.  And I’m up and running.  Thank you!

   

Avatar
Fabrice Closier, Administrator
Posted: 19 November 2012 09:11 AM   Total Posts: 1265   [ # 3 ]

The force of the habit… wink

   

GiGBiG, Member
Posted: 10 January 2013 08:50 AM   Total Posts: 57   [ # 4 ]

Hi Fabrice!
I would like to continue this discussion: ok, now I know that I can export my models for an older version of Away3D, but what if I wanted to keep the old AS3 models while updating the Away3D libs?
I’d prefer not to re-export all the models or change/modify/restore old classes everytime I update them.

I need to update Away3D libs because I need to fix several bugs from the 4.0 versions, and I have tried too, but while in the old models version I just needed to restore one/two old (discarded) Away3D classes, with the new version I need to change a lot of things, and I abandoned the idea. So I am stuck with the old Away3D (and consequently Prefab3D) version.
Please can you explain if and how I can avoid this hassle?

Thank you for the hard work!

   

Avatar
Fabrice Closier, Administrator
Posted: 10 January 2013 10:16 AM   Total Posts: 1265   [ # 5 ]

[but what if I wanted to keep the old AS3 models]
By definition, AS3 classes must fit requirements of player version, engine version etc.. so in that regard there is not much I can do.

[I’d prefer not to re-export all the models or change/modify/restore old classes everytime I update them.]
I assume we talk here about 4.0/4.1, not a away 3.x to 4.0.
That you do use models as external file or not, you have to update your code anyway to meet engine version requirements, automated outputs (Prefab’s) or custom.
If you have exported with external data, note that all the asd’s are reusable too.

If you make one export and compair both versions outputs, you’ll discover that only one class (shared to all exports needs replacement) and that all other classes would only require a find and replace for 1 or 2 imports. In short, if you have not been destructive with the exports, porting them to 4.0 from 4.1 or vice versa could be made in a matter of minutes, if not seconds…

The export classes are designed to be easylly added or removed from a project but If you have modified them for a great deal… I can’t do much in this case.

On another but related topic, I’m currently working on Prefab’s next update. This update will bring a massive change to your flow and will indirectly fix more or less your publishing/target issue…

You say you have found bugs. Have you reported them on GitHub? If not, please do so.

   

GiGBiG, Member
Posted: 10 January 2013 11:08 AM   Total Posts: 57   [ # 6 ]

Thank you! I have just had a look at the AS3 model classes and effectively they could be replaced keeping the ASDs, nice!

Well, sorry for not specifying, I was talking about a migration from 4.0 to 4.1, it was obvious for me but not for you wink

I am now using the master branch, and it does not require any kind of re-export of the models, while the dev branch is very different and throws errors. What is the difference between the two versions? I noticed a lot of differences in the PB folder and the AGAL too.

The big bug I am referring to is the well known “context dispose” thrown when going to sleep-mode or in the device-loss: well, I noticed that in 4.1 master branch it is not fixed yet… I am f….d :O

   

Avatar
Fabrice Closier, Administrator
Posted: 10 January 2013 03:30 PM   Total Posts: 1265   [ # 7 ]

Well, as said, going from 4.0 to 4.1 by modifying the exports is very easy if you haven’t f——d the classes too much. The asbase must be replace by a new one, and a simple find a replace on your classes will do for 1 or 2 imports/type.

dev is 4.1 alpha.

If your migration is motivated by the loss of context issue alone, it’s not really necessary to do the move… Unless your project is very complex in terms of geometry and requires high efficiency (compactGeoms, atf etc), there are no or little gain compared to use stable 4.0 for most projects. Again 4.1 is alpha, this means that your project could be affected by changes made to the api.

It is highly recommended, for commercial projects, unless you badly need a certain new feature, to use official version. The dev branch is there for you so you can “make yourself at home” with the new version. Also the time to make some requests, report bugs etc…

   

GiGBiG, Member
Posted: 10 January 2013 05:19 PM   Total Posts: 57   [ # 8 ]

Well, my motivations are performances (I have found out that a bmp as bg in stage3D is terribly heavy for a MacBook in Chrome) and the context loss.

Sorry for complaining about the AS3 export, I am a bit under pressure.

Thank you for your explanations, keep up the good work!

   

ayman, Newbie
Posted: 15 July 2013 09:35 AM   Total Posts: 5   [ # 9 ]
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X