Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

major update

  • Loading branch information...
commit 5292313906000bc94655f54cbb8c9a797e586de1 1 parent 39f0c82
@keyemkey keyemkey authored
Showing with 95,239 additions and 858 deletions.
  1. BIN  awaybuilder-core/src/assets/disclosureClosedIcon.png
  2. BIN  awaybuilder-core/src/assets/disclosureOpenIcon.png
  3. +195 −142 awaybuilder-core/src/awaybuilder/controller/ReadDocumentDataCommand.as
  4. +2 −2 awaybuilder-core/src/awaybuilder/events/HelpEvent.as
  5. +22 −0 awaybuilder-core/src/awaybuilder/events/SceneEvent.as
  6. +22 −0 awaybuilder-core/src/awaybuilder/model/DocumentModel.as
  7. +1 −1  awaybuilder-core/src/awaybuilder/model/EditorModel.as
  8. +8 −2 awaybuilder-core/src/awaybuilder/model/IDocumentModel.as
  9. +1 −1  awaybuilder-core/src/awaybuilder/model/{ → vo}/ObjectPickerCategoryItem.as
  10. +2 −3 awaybuilder-core/src/awaybuilder/model/{ → vo}/SampleItem.as
  11. +4 −1 awaybuilder-core/src/awaybuilder/model/vo/ScenegraphTreeVO.as
  12. +15 −6 awaybuilder-core/src/awaybuilder/scene/controllers/Scene3DManager.as
  13. +0 −52 awaybuilder-core/src/awaybuilder/utils/ZoomUtil.as
  14. +18 −0 awaybuilder-core/src/awaybuilder/utils/logging/ArrayUtil.as
  15. +1 −28 awaybuilder-core/src/awaybuilder/{ → utils}/printing/FlexPrintJob.as
  16. +0 −16 awaybuilder-core/src/awaybuilder/utils/sliderValueToZoomValue.as
  17. +0 −11 awaybuilder-core/src/awaybuilder/utils/zoomValueToSliderValue.as
  18. +86 −0 awaybuilder-core/src/awaybuilder/view/components/CollapsiblePanel.as
  19. +52 −24 awaybuilder-core/src/awaybuilder/view/components/CoreEditor.mxml
  20. +26 −28 awaybuilder-core/src/awaybuilder/view/components/EditStatusBar.mxml
  21. +8 −7 awaybuilder-core/src/awaybuilder/view/components/EditToolBar.mxml
  22. +0 −101 awaybuilder-core/src/awaybuilder/view/components/EditorGrid.as
  23. +20 −0 awaybuilder-core/src/awaybuilder/view/components/SwitchButton.as
  24. +18 −0 awaybuilder-core/src/awaybuilder/view/components/events/CoreEditorEvent.as
  25. +0 −13 awaybuilder-core/src/awaybuilder/view/components/propertyEditors/IObjectPropertyEditor.as
  26. +73 −0 awaybuilder-core/src/awaybuilder/view/components/propertyEditors/MeshPropertyEditor.mxml
  27. +0 −90 awaybuilder-core/src/awaybuilder/view/components/propertyEditors/ShapePropertyEditor.mxml
  28. +26 −0 awaybuilder-core/src/awaybuilder/view/components/tree/Tree.as
  29. +22 −4 awaybuilder-core/src/awaybuilder/view/components/tree/TreeItemRenderer.mxml
  30. +128 −7 awaybuilder-core/src/awaybuilder/view/mediators/CoreEditorMediator.as
  31. +6 −3 awaybuilder-core/src/awaybuilder/view/mediators/EditStatusBarMediator.as
  32. +1 −1  awaybuilder-core/src/awaybuilder/view/mediators/SamplePickerMediator.as
  33. +3 −4 ...er-core/src/awaybuilder/view/skins/{ObjectPickerCollapseButtonSkin.mxml → CollapseLeftButtonSkin.mxml}
  34. +155 −0 awaybuilder-core/src/awaybuilder/view/skins/CollapseRightButtonSkin.mxml
  35. +119 −0 awaybuilder-core/src/awaybuilder/view/skins/CollapsiblePanelSkin.mxml
  36. +117 −0 awaybuilder-core/src/awaybuilder/view/skins/CollapsibleRightPanelSkin.mxml
  37. +0 −160 awaybuilder-core/src/awaybuilder/view/skins/ObjectPickerCategoryCollapseButtonSkin.mxml
  38. +126 −0 awaybuilder-core/src/awaybuilder/view/skins/PropertyFormItemSkin.mxml
  39. +65 −0 awaybuilder-core/src/awaybuilder/view/skins/PropertyFormSkin.mxml
  40. +0 −33 awaybuilder-core/src/awaybuilder/view/skins/TreeSkin.mxml
  41. 0  awaybuilder-core/src/awaybuilder/view/skins/{ → fxg}/CollapseArrowDownSkin.fxg
  42. 0  awaybuilder-core/src/awaybuilder/view/skins/{ → fxg}/CollapseArrowLeftSkin.fxg
  43. 0  awaybuilder-core/src/awaybuilder/view/skins/{ → fxg}/CollapseArrowRightSkin.fxg
  44. 0  awaybuilder-core/src/awaybuilder/view/skins/{ → fxg}/CollapseArrowUpSkin.fxg
  45. +8 −1 awaybuilder-core/src/defaults.css
  46. +2 −3 awaybuilder-desktop/src/AwayBuilderApplication.mxml
  47. +1 −1  awaybuilder-desktop/src/awaybuilder/desktop/DesktopAppContext.as
  48. +39 −42 awaybuilder-desktop/src/awaybuilder/desktop/services/FileSystemDocumentService.as
  49. +15 −14 awaybuilder-desktop/src/awaybuilder/desktop/view/mediators/DesktopAppMediator.as
  50. +1 −1  awaybuilder-desktop/src/awaybuilder/desktop/view/mediators/WelcomeWindowMediator.as
  51. +1 −11 awaybuilder-desktop/src/awaybuilder/desktop/view/skins/DesktopAppSkin.mxml
  52. +1 −45 awaybuilder-desktop/src/awaybuilder/desktop/view/skins/WindowSkin.mxml
  53. BIN  exampleScenes/3ds/soldier_ant.3ds
  54. BIN  exampleScenes/3ds/texture.jpg
  55. 0  {awaybuilder-core/src/assets → exampleScenes/awd}/bear/PolarBear.awd
  56. BIN  exampleScenes/awd/bear/polarbear_diffuse.jpg
  57. BIN  exampleScenes/awd/bear/polarbear_normals.jpg
  58. BIN  exampleScenes/awd/bear/polarbear_specular.jpg
  59. BIN  exampleScenes/awd/level.awd
  60. BIN  exampleScenes/awd/onkba/floor_diffuse.jpg
  61. BIN  exampleScenes/awd/onkba/floor_normals.jpg
  62. BIN  exampleScenes/awd/onkba/floor_specular.jpg
  63. BIN  exampleScenes/awd/onkba/gun_diffuse.jpg
  64. BIN  exampleScenes/awd/onkba/gun_lightmap.jpg
  65. BIN  exampleScenes/awd/onkba/gun_normals.jpg
  66. BIN  exampleScenes/awd/onkba/onkba.awd
  67. BIN  exampleScenes/awd/onkba/onkba_diffuse.png
  68. BIN  exampleScenes/awd/onkba/onkba_lightmap.jpg
  69. BIN  exampleScenes/awd/onkba/onkba_normals.jpg
  70. BIN  exampleScenes/awd/sponza/arch_ddn.jpg
  71. BIN  exampleScenes/awd/sponza/arch_diff.jpg
  72. BIN  exampleScenes/awd/sponza/arch_spec.jpg
  73. BIN  exampleScenes/awd/sponza/atf/arch_ddn.atf
  74. BIN  exampleScenes/awd/sponza/atf/arch_diff.atf
  75. BIN  exampleScenes/awd/sponza/atf/arch_spec.atf
  76. BIN  exampleScenes/awd/sponza/atf/background.atf
  77. BIN  exampleScenes/awd/sponza/atf/background_ddn.atf
  78. BIN  exampleScenes/awd/sponza/atf/bricks_a_ddn.atf
  79. BIN  exampleScenes/awd/sponza/atf/bricks_a_diff.atf
  80. BIN  exampleScenes/awd/sponza/atf/bricks_a_spec.atf
  81. BIN  exampleScenes/awd/sponza/atf/ceiling_a_diff.atf
  82. BIN  exampleScenes/awd/sponza/atf/ceiling_a_spec.atf
  83. BIN  exampleScenes/awd/sponza/atf/chain_texture.atf
  84. BIN  exampleScenes/awd/sponza/atf/chain_texture_ddn.atf
  85. BIN  exampleScenes/awd/sponza/atf/column_a_ddn.atf
  86. BIN  exampleScenes/awd/sponza/atf/column_a_diff.atf
  87. BIN  exampleScenes/awd/sponza/atf/column_a_spec.atf
  88. BIN  exampleScenes/awd/sponza/atf/column_b_ddn.atf
  89. BIN  exampleScenes/awd/sponza/atf/column_b_diff.atf
  90. BIN  exampleScenes/awd/sponza/atf/column_b_spec.atf
  91. BIN  exampleScenes/awd/sponza/atf/column_c_ddn.atf
  92. BIN  exampleScenes/awd/sponza/atf/column_c_diff.atf
  93. BIN  exampleScenes/awd/sponza/atf/column_c_spec.atf
  94. BIN  exampleScenes/awd/sponza/atf/curtain_blue_diff.atf
  95. BIN  exampleScenes/awd/sponza/atf/curtain_diff.atf
  96. BIN  exampleScenes/awd/sponza/atf/curtain_green_diff.atf
  97. BIN  exampleScenes/awd/sponza/atf/curtain_spec.atf
  98. BIN  exampleScenes/awd/sponza/atf/details_diff.atf
  99. BIN  exampleScenes/awd/sponza/atf/details_spec.atf
  100. BIN  exampleScenes/awd/sponza/atf/fabric_blue_diff.atf
  101. BIN  exampleScenes/awd/sponza/atf/fabric_diff.atf
  102. BIN  exampleScenes/awd/sponza/atf/fabric_green_diff.atf
  103. BIN  exampleScenes/awd/sponza/atf/fabric_spec.atf
  104. BIN  exampleScenes/awd/sponza/atf/flagpole_diff.atf
  105. BIN  exampleScenes/awd/sponza/atf/flagpole_spec.atf
  106. BIN  exampleScenes/awd/sponza/atf/floor_a_diff.atf
  107. BIN  exampleScenes/awd/sponza/atf/floor_a_spec.atf
  108. BIN  exampleScenes/awd/sponza/atf/gi_flag.atf
  109. BIN  exampleScenes/awd/sponza/atf/hourglass_cubemap2.atf
  110. BIN  exampleScenes/awd/sponza/atf/lion.atf
  111. BIN  exampleScenes/awd/sponza/atf/lion2_ddn.atf
  112. BIN  exampleScenes/awd/sponza/atf/r2d2-texture.atf
  113. BIN  exampleScenes/awd/sponza/atf/roof_diff.atf
  114. BIN  exampleScenes/awd/sponza/atf/thorn_ddn.atf
  115. BIN  exampleScenes/awd/sponza/atf/thorn_diff.atf
  116. BIN  exampleScenes/awd/sponza/atf/thorn_spec.atf
  117. BIN  exampleScenes/awd/sponza/atf/vase_ddn.atf
  118. BIN  exampleScenes/awd/sponza/atf/vase_dif.atf
  119. BIN  exampleScenes/awd/sponza/atf/vase_hanging.atf
  120. BIN  exampleScenes/awd/sponza/atf/vase_plant.atf
  121. BIN  exampleScenes/awd/sponza/atf/vase_plant_spec.atf
  122. BIN  exampleScenes/awd/sponza/atf/vase_round.atf
  123. BIN  exampleScenes/awd/sponza/atf/vase_round_ddn.atf
  124. BIN  exampleScenes/awd/sponza/atf/vase_round_spec.atf
  125. BIN  exampleScenes/awd/sponza/background.jpg
  126. BIN  exampleScenes/awd/sponza/background_ddn.jpg
  127. BIN  exampleScenes/awd/sponza/bricks_a_ddn.jpg
  128. BIN  exampleScenes/awd/sponza/bricks_a_diff.jpg
  129. BIN  exampleScenes/awd/sponza/bricks_a_spec.jpg
  130. BIN  exampleScenes/awd/sponza/ceiling_a_diff.jpg
  131. BIN  exampleScenes/awd/sponza/ceiling_a_spec.jpg
  132. BIN  exampleScenes/awd/sponza/chain_texture.png
  133. BIN  exampleScenes/awd/sponza/chain_texture_ddn.jpg
  134. BIN  exampleScenes/awd/sponza/column_a_ddn.jpg
  135. BIN  exampleScenes/awd/sponza/column_a_diff.jpg
  136. BIN  exampleScenes/awd/sponza/column_a_spec.jpg
  137. BIN  exampleScenes/awd/sponza/column_b_ddn.jpg
  138. BIN  exampleScenes/awd/sponza/column_b_diff.jpg
  139. BIN  exampleScenes/awd/sponza/column_b_spec.jpg
  140. BIN  exampleScenes/awd/sponza/column_c_ddn.jpg
  141. BIN  exampleScenes/awd/sponza/column_c_diff.jpg
  142. BIN  exampleScenes/awd/sponza/column_c_spec.jpg
  143. BIN  exampleScenes/awd/sponza/curtain_blue_diff.jpg
  144. BIN  exampleScenes/awd/sponza/curtain_diff.jpg
  145. BIN  exampleScenes/awd/sponza/curtain_green_diff.jpg
  146. BIN  exampleScenes/awd/sponza/curtain_spec.jpg
  147. BIN  exampleScenes/awd/sponza/details_diff.jpg
  148. BIN  exampleScenes/awd/sponza/details_spec.jpg
  149. BIN  exampleScenes/awd/sponza/fabric_blue_diff.jpg
  150. BIN  exampleScenes/awd/sponza/fabric_diff.jpg
  151. BIN  exampleScenes/awd/sponza/fabric_green_diff.jpg
  152. BIN  exampleScenes/awd/sponza/fabric_spec.jpg
  153. BIN  exampleScenes/awd/sponza/flagpole_diff.jpg
  154. BIN  exampleScenes/awd/sponza/flagpole_spec.jpg
  155. BIN  exampleScenes/awd/sponza/floor_a_diff.jpg
  156. BIN  exampleScenes/awd/sponza/floor_a_spec.jpg
  157. BIN  exampleScenes/awd/sponza/gi_flag.jpg
  158. BIN  exampleScenes/awd/sponza/lion.jpg
  159. BIN  exampleScenes/awd/sponza/lion2_ddn.jpg
  160. BIN  exampleScenes/awd/sponza/r2d2 texture.jpg
  161. BIN  exampleScenes/awd/sponza/roof_diff.jpg
  162. BIN  exampleScenes/awd/sponza/sponza.awd
  163. BIN  exampleScenes/awd/sponza/thorn_ddn.jpg
  164. BIN  exampleScenes/awd/sponza/thorn_diff.jpg
  165. BIN  exampleScenes/awd/sponza/thorn_diff.png
  166. BIN  exampleScenes/awd/sponza/thorn_spec.jpg
  167. BIN  exampleScenes/awd/sponza/vase_ddn.jpg
  168. BIN  exampleScenes/awd/sponza/vase_dif.jpg
  169. BIN  exampleScenes/awd/sponza/vase_hanging.jpg
  170. BIN  exampleScenes/awd/sponza/vase_plant.png
  171. BIN  exampleScenes/awd/sponza/vase_plant_spec.jpg
  172. BIN  exampleScenes/awd/sponza/vase_round.jpg
  173. BIN  exampleScenes/awd/sponza/vase_round_ddn.jpg
  174. BIN  exampleScenes/awd/sponza/vase_round_spec.jpg
  175. BIN  exampleScenes/md2/ogre/igdosh.jpg
  176. BIN  exampleScenes/md2/ogre/ogre.md2
  177. BIN  exampleScenes/md2/ogre/ogre_normals.png
  178. BIN  exampleScenes/md2/ogre/ogre_specular.jpg
  179. +2,556 −0 exampleScenes/md5/attack2.md5anim
  180. +3,020 −0 exampleScenes/md5/attack3.md5anim
  181. +956 −0 exampleScenes/md5/chest.md5anim
  182. +748 −0 exampleScenes/md5/headpain.md5anim
  183. +8,033 −0 exampleScenes/md5/hellknight.md5mesh
  184. BIN  exampleScenes/md5/hellknight_diffuse.jpg
  185. BIN  exampleScenes/md5/hellknight_normals.png
  186. BIN  exampleScenes/md5/hellknight_specular.png
  187. +6,836 −0 exampleScenes/md5/idle2.md5anim
  188. +360 −0 exampleScenes/md5/ik_pose.md5anim
  189. +244 −0 exampleScenes/md5/initial.md5anim
  190. +2,459 −0 exampleScenes/md5/leftslash.md5anim
  191. +626 −0 exampleScenes/md5/pain1.md5anim
  192. +748 −0 exampleScenes/md5/pain_luparm.md5anim
  193. +828 −0 exampleScenes/md5/pain_ruparm.md5anim
  194. +4,721 −0 exampleScenes/md5/range_attack2.md5anim
  195. +3,251 −0 exampleScenes/md5/roar1.md5anim
  196. +6,836 −0 exampleScenes/md5/stand.md5anim
  197. +2,036 −0 exampleScenes/md5/turret_attack.md5anim
  198. +2,604 −0 exampleScenes/md5/walk7.md5anim
  199. +2,641 −0 exampleScenes/md5/walk7_left.md5anim
  200. +44,326 −0 exampleScenes/obj/head.obj
  201. BIN  exampleScenes/obj/head_diffuse.jpg
  202. BIN  exampleScenes/obj/head_normals.jpg
  203. BIN  exampleScenes/obj/head_specular.jpg
View
BIN  awaybuilder-core/src/assets/disclosureClosedIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  awaybuilder-core/src/assets/disclosureOpenIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
337 awaybuilder-core/src/awaybuilder/controller/ReadDocumentDataCommand.as
@@ -3,14 +3,22 @@ package awaybuilder.controller
import flash.net.URLRequest;
import mx.collections.ArrayCollection;
+ import mx.controls.Alert;
+ import away3d.animators.AnimationSetBase;
+ import away3d.animators.AnimationStateBase;
+ import away3d.animators.nodes.AnimationNodeBase;
+ import away3d.containers.ObjectContainer3D;
+ import away3d.core.base.Geometry;
+ import away3d.core.base.SubGeometry;
import away3d.entities.Mesh;
import away3d.events.AssetEvent;
+ import away3d.events.LoaderEvent;
import away3d.library.AssetLibrary;
import away3d.library.assets.AssetType;
import away3d.loaders.parsers.Parsers;
import away3d.materials.TextureMaterial;
- import away3d.utils.Cast;
+ import away3d.textures.BitmapTexture;
import awaybuilder.events.ReadDocumentDataEvent;
import awaybuilder.model.IDocumentModel;
@@ -23,9 +31,7 @@ package awaybuilder.controller
public class ReadDocumentDataCommand extends Command
{
- private static const FUTURE_VERSION_ERROR:String = "Unable to open file. This document appears to have been created in a newer version of awaybuilder.";
- private static const INVALID_FORMAT_ERROR:String = "Unable to open file. Cannot parse data.";
-
+
[Inject]
public var document:IDocumentModel;
@@ -38,159 +44,206 @@ package awaybuilder.controller
[Inject]
public var event:ReadDocumentDataEvent;
+
+ private var _scenegraph:ArrayCollection;
+
+ private var _sceneObjects:ArrayCollection;
+
+ private var _materialObjects:ArrayCollection;
+
+ private var _animationObjects:ArrayCollection;
+
+ private var _geometryObjects:ArrayCollection;
+
+ private var _lightObjects:ArrayCollection;
+
override public function execute():void
{
-// scenegraph = new ArrayCollection();
+ _scenegraph = new ArrayCollection();
+ _sceneObjects = new ArrayCollection();
+ _materialObjects = new ArrayCollection();
+ _animationObjects = new ArrayCollection();
+ _geometryObjects = new ArrayCollection();
+ _lightObjects = new ArrayCollection();
+
document.name = event.name;
Parsers.enableAllBundled();
- AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetComplete);
+ AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, assetCompleteHandler);
+ AssetLibrary.addEventListener(LoaderEvent.RESOURCE_COMPLETE, resourceCompleteHandler);
+ AssetLibrary.addEventListener(LoaderEvent.LOAD_ERROR, loadErrorHandler);
AssetLibrary.load(new URLRequest(event.path));
}
- [Embed(source="assets/bear/polarbear_diffuse.jpg")]
- private var BearDiffuse:Class;
-
- [Embed(source="assets/bear/polarbear_normals.jpg")]
- private var BearNormal:Class;
-
- [Embed(source="assets/bear/polarbear_specular.jpg")]
- private var BearSpecular:Class;
-
-// private var tm:Number;
- private var bear:Mesh;
+ private function loadErrorHandler( event:LoaderEvent ):void
+ {
+ Alert.show( event.message, "Resource not loaded" );
+ }
- private function onAssetComplete(e:AssetEvent):void
+ private function resourceCompleteHandler( event:LoaderEvent ):void
+ {
+ if( _animationObjects.length )
+ {
+ var animationItem:ScenegraphTreeVO = new ScenegraphTreeVO( "Animation", null );
+ animationItem.children = _animationObjects;
+ _scenegraph.addItemAt( animationItem, 0 );
+ }
+ if( _geometryObjects.length )
+ {
+ var geometryItem:ScenegraphTreeVO = new ScenegraphTreeVO( "Geometry", null );
+ geometryItem.children = _geometryObjects;
+ _scenegraph.addItemAt( geometryItem, 0 );
+ }
+ if( _sceneObjects.length )
+ {
+ var sceneItem:ScenegraphTreeVO = new ScenegraphTreeVO( "Scene", null );
+ sceneItem.children = _sceneObjects;
+ _scenegraph.addItemAt( sceneItem, 0 );
+ }
+
+ var lightsItem:ScenegraphTreeVO = new ScenegraphTreeVO( "Lights", null );
+ _scenegraph.addItem( lightsItem );
+
+ document.scenegraph = _scenegraph;
+ document.sceneObjects = _sceneObjects;
+// trace( _mesh.parent );
+// if( _mesh.material ) {
+// Scene3DManager.addMesh( _mesh );
+// }
+// else {
+// Alert.show( "Mesh was not added to scene, material is undefined", "Warning" );
+// }
+
+ }
+ private function assetCompleteHandler( event:AssetEvent ):void
{
- var scenegraph = new ArrayCollection();
- var item:ScenegraphTreeVO = new ScenegraphTreeVO( "Mesh" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "ObjectContainer3D" );
- item.children = new ArrayCollection();
- item.children.addItem( new ScenegraphTreeVO( "subitem1" ) );
- item.children.addItem( new ScenegraphTreeVO( "subitem2" ) );
- item.children.addItem( new ScenegraphTreeVO( "subitem3" ) );
- item.children.addItem( new ScenegraphTreeVO( "subitem4" ) );
- item.children.addItem( new ScenegraphTreeVO( "subitem42" ) );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "Material" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "Geometry" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "Animator" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "AnimationSet" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "AnimationNode" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "Texture" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "LightPicker" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "Light" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "ShadowMapper" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "ShadowMethod" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "EffectsMethod" );
- scenegraph.addItem( item );
- item = new ScenegraphTreeVO( "Camera" );
- scenegraph.addItem( item );
- document.scenegraph = scenegraph;
-// -- ObjectContainer3D
-// | |
-// | -- ObjectContainer3D...
-// | -- Camera §
-// | -- Light §
-// | -- Mesh...
-// | -- Mesh...
-// | -- Mesh
-// | |
-// | -- Material §
-// | -- Geometry §
-// | -- Animator §
-// | -- SubMesh...
-// | -- SubMesh...
-// | -- SubMesh
-// | |
-// | -- Material §
-// | -- SubGeometry §
-// |
-// -- Material
-// | |
-// | -- LightPicker §
-// | -- DiffuseTexture §
-// | -- DiffuseMethod
-// | -- SpecularTexture §
-// | -- SpecularMethod
-// | -- NormalTexture §
-// | -- NormalMethod
-// | -- ShadowMethod §
-// | -- EffectsMethod §
-// | -- EffectsMethod §
-// | -- EffectsMethod §...
-// |
-// -- Geometry
-// | |
-// | -- SubGeometry
-// | -- SubGeometry
-// | -- SubGeometry...
-// |
-// -- Animator
-// | |
-// | -- AnimationSet §
-// |
-// -- AnimationSet
-// | |
-// | -- AnimationNode
-// | -- AnimationNode
-// | -- AnimationNode...
-// |
-// -- AnimationNode
-// |
-// -- Texture
-// |
-// -- LightPicker
-// | |
-// | -- Light §
-// |
-// -- Light
-// | |
-// | -- ShadowMapper §
-// |
-// -- ShadowMapper
-// |
-// -- ShadowMethod
-// |
-// -- EffectsMethod
-// |
-// -- Camera
-
+ trace( event.asset.assetType );
- if (e.asset.assetType == AssetType.MESH)
- {
- bear = e.asset as Mesh;
-
- var meshMaterial:TextureMaterial = new TextureMaterial(Cast.bitmapTexture(BearDiffuse));
- //bearMaterial.shadowMethod = filteredShadowMapMethod;
- meshMaterial.normalMap = Cast.bitmapTexture(BearNormal);
- meshMaterial.specularMap = Cast.bitmapTexture(BearSpecular);
- meshMaterial.gloss = 50;
- meshMaterial.specular = 0.5;
- meshMaterial.ambientColor = 0xAAAAAA;
- meshMaterial.ambient = 0.5;
-
- //var meshMaterial:ColorMaterial = new ColorMaterial();
+// var _light:DirectionalLight = new DirectionalLight(-1, -1, 1);
+//// _direction = new Vector3D(-1, -1, 1);
+// var _lightPicker:StaticLightPicker = new StaticLightPicker([_light]);
+// Scene3DManager.addLight( _light );
+//
+ var item:ScenegraphTreeVO;
+ if (event.asset.assetType == AssetType.MESH)
+ {
+ var mesh:Mesh = event.asset as Mesh;
+ item = new ScenegraphTreeVO( mesh.name , mesh );
+ _sceneObjects.addItem( item );
- bear.material = meshMaterial;
- bear.castsShadows = true;
- bear.rotationY = 45;
+ if( mesh.material ) {
+ Scene3DManager.addMesh( mesh );
+ }
+ else {
+ Alert.show( "Mesh was not added to scene, material is undefined", "Warning" );
+ }
- Scene3DManager.addMesh(bear);
- Scene3DManager.addLightToMesh(bear, "SunLight");
+// mesh.castsShadows = true;
+ }
+ else if (event.asset.assetType == AssetType.CONTAINER)
+ {
+ var c:ObjectContainer3D = event.asset as ObjectContainer3D;
+ item = new ScenegraphTreeVO( "Container (" + c.name +")", c );
+ item.children = new ArrayCollection();
+ _sceneObjects.addItem( item );
+ }
+ else if (event.asset.assetType == AssetType.MATERIAL)
+ {
+ var material:TextureMaterial = event.asset as TextureMaterial;
+ item = new ScenegraphTreeVO( "Material (" + material.name +")", material );
+ item.children = new ArrayCollection();
+ if( material.lightPicker ) {
+ item.children.addItem( new ScenegraphTreeVO( "LightPicker (" + material.lightPicker.name +")", material.lightPicker ) );
+ }
+ if( material.diffuseMethod ) {
+ item.children.addItem( new ScenegraphTreeVO( "DiffuseMethod", material.diffuseMethod ) );
+ }
+ if( material.normalMethod ) {
+ item.children.addItem( new ScenegraphTreeVO( "NormalMethod", material.normalMethod ) );
+ }
+ /*item.children.addItem( new ScenegraphTreeVO( "Material (" + material.name +")" ) );
+ item.children.addItem( new ScenegraphTreeVO( "Material (" + material.name +")" ) );
+ item.children.addItem( new ScenegraphTreeVO( "Material (" + material.name +")" ) );
+ item.children.addItem( new ScenegraphTreeVO( "Material (" + material.name +")" ) );*/
+ _scenegraph.addItem( item );
+ }
+ else if (event.asset.assetType == AssetType.TEXTURE)
+ {
+ var texture:BitmapTexture = event.asset as BitmapTexture;
+ item = new ScenegraphTreeVO( "Texture (" + texture.originalName.split("/").pop() +")", texture );
+ _scenegraph.addItem( item );
+ }
+ else if (event.asset.assetType == AssetType.GEOMETRY)
+ {
+ var geometry:Geometry = event.asset as Geometry;
+ item = new ScenegraphTreeVO( geometry.name ,geometry );
+ _geometryObjects.addItem( item );
+ item.children = new ArrayCollection();
+ for each( var g:SubGeometry in geometry.subGeometries ) {
+ item.children.addItem( new ScenegraphTreeVO( "SubGeometry",g ) );
+ }
+ }
+ else if (event.asset.assetType == AssetType.ANIMATION_SET)
+ {
+ var animationSet:AnimationSetBase = event.asset as AnimationSetBase;
+ item = new ScenegraphTreeVO( "Animation Set (" + animationSet.name +")",animationSet );
+ _animationObjects.addItem( item );
}
+ else if (event.asset.assetType == AssetType.ANIMATION_STATE)
+ {
+ var animationState:AnimationStateBase = event.asset as AnimationStateBase;
+ item = new ScenegraphTreeVO( "Animation State (" + animationState.name +")",animationState );
+ _animationObjects.addItem( item );
+ }
+ else if (event.asset.assetType == AssetType.ANIMATION_NODE)
+ {
+ var animationNode:AnimationNodeBase = event.asset as AnimationNodeBase;
+ item = new ScenegraphTreeVO( "Animation Node (" + animationNode.name +")",animationNode );
+ _animationObjects.addItem( item );
+ }
+// switch( event.asset.assetType ) {
+// case AssetType.MESH:
+// var mesh:Mesh = event.asset as Mesh;
+//// mesh.castsShadows = true;
+// Scene3DManager.addMesh(mesh);
+// break;
+// case AssetType.MATERIAL:
+// var material:TextureMaterial = event.asset as TextureMaterial;
+//// material.shadowMethod = new FilteredShadowMapMethod(_light);
+//// material.lightPicker = _lightPicker;
+// material.gloss = 30;
+// material.specular = 1;
+// material.ambientColor = 0x303040;
+// material.ambient = 1;
+//// Scene3DManager.a
+// break;
+// }
+
+// if (e.asset.assetType == AssetType.MESH)
+// {
+// bear = e.asset as Mesh;
+//
+// var meshMaterial:TextureMaterial = new TextureMaterial(Cast.bitmapTexture(BearDiffuse));
+// //bearMaterial.shadowMethod = filteredShadowMapMethod;
+// meshMaterial.normalMap = Cast.bitmapTexture(BearNormal);
+// meshMaterial.specularMap = Cast.bitmapTexture(BearSpecular);
+// meshMaterial.gloss = 50;
+// meshMaterial.specular = 0.5;
+// meshMaterial.ambientColor = 0xAAAAAA;
+// meshMaterial.ambient = 0.5;
+//
+// //var meshMaterial:ColorMaterial = new ColorMaterial();
+//
+// bear.material = meshMaterial;
+// bear.castsShadows = true;
+// bear.rotationY = 45;
+//
+// Scene3DManager.addMesh(bear);
+// Scene3DManager.addLightToMesh(bear, "SunLight");
+//
+// }
+
}
}
View
4 awaybuilder-core/src/awaybuilder/events/HelpEvent.as
@@ -4,8 +4,8 @@ package awaybuilder.events
public class HelpEvent extends Event
{
- public static const SHOW_SAMPLES:String = "showSamples";
- public static const HIDE_SAMPLES:String = "hideSamples";
+ public static const SHOW_WELCOME:String = "showWelcome";
+ public static const HIDE_WELCOME:String = "hideWelcome";
public function HelpEvent(type:String)
{
View
22 awaybuilder-core/src/awaybuilder/events/SceneEvent.as
@@ -0,0 +1,22 @@
+package awaybuilder.events
+{
+ import flash.events.Event;
+
+ public class SceneEvent extends Event
+ {
+ public static const ITEMS_SELECT:String = "sceneItemSelect";
+
+ public function SceneEvent(type:String, items:Vector.<Object>)
+ {
+ super(type, false, false);
+ this.items = items;
+ }
+
+ public var items:Vector.<Object>;
+
+ override public function clone():Event
+ {
+ return new SceneEvent(this.type, this.items);
+ }
+ }
+}
View
22 awaybuilder-core/src/awaybuilder/model/DocumentModel.as
@@ -71,5 +71,27 @@ package awaybuilder.model
this.dispatch(new DocumentModelEvent(DocumentModelEvent.DOCUMENT_UPDATED));
}
+ private var _sceneObjects:ArrayCollection = new ArrayCollection();
+ public function get sceneObjects():ArrayCollection
+ {
+ return this._sceneObjects;
+ }
+ public function set sceneObjects(value:ArrayCollection):void
+ {
+ this._sceneObjects = value;
+ this.dispatch(new DocumentModelEvent(DocumentModelEvent.DOCUMENT_UPDATED));
+ }
+
+ private var _selectedObjects:Vector.<Object> = new Vector.<Object>();
+ public function get selectedObjects():Vector.<Object>
+ {
+ return this._selectedObjects;
+ }
+ public function set selectedObjects(value:Vector.<Object>):void
+ {
+ this._selectedObjects = value;
+ this.dispatch(new DocumentModelEvent(DocumentModelEvent.DOCUMENT_UPDATED));
+ }
+
}
}
View
2  awaybuilder-core/src/awaybuilder/model/EditorModel.as
@@ -6,7 +6,7 @@ package awaybuilder.model
public class EditorModel extends Actor implements IEditorModel
{
- private var _zoom:Number = 1;
+ private var _zoom:Number = 0.9;
public function get zoom():Number
{
View
10 awaybuilder-core/src/awaybuilder/model/IDocumentModel.as
@@ -8,14 +8,20 @@ package awaybuilder.model
function set name(value:String):void;
function get edited():Boolean;
function set edited(value:Boolean):void;
- function get suppressEdits():Boolean;
- function set suppressEdits(value:Boolean):void;
+// function get suppressEdits():Boolean;
+// function set suppressEdits(value:Boolean):void;
function get path():String;
function set path(value:String):void;
function get scenegraph():ArrayCollection;
function set scenegraph(value:ArrayCollection):void;
+ function get sceneObjects():ArrayCollection;
+ function set sceneObjects(value:ArrayCollection):void;
+
+ function get selectedObjects():Vector.<Object>;
+ function set selectedObjects(value:Vector.<Object>):void;
+
// function addObject(object:IEditorObjectView):void;
// function removeObject(object:IEditorObjectView):void;
View
2  ...src/awaybuilder/model/ObjectPickerCategoryItem.as → .../awaybuilder/model/vo/ObjectPickerCategoryItem.as
@@ -1,4 +1,4 @@
-package awaybuilder.model
+package awaybuilder.model.vo
{
public class ObjectPickerCategoryItem
{
View
5 awaybuilder-core/src/awaybuilder/model/SampleItem.as → ...ilder-core/src/awaybuilder/model/vo/SampleItem.as
@@ -1,7 +1,6 @@
-package awaybuilder.model
+package awaybuilder.model.vo
{
- import flash.display.DisplayObject;
- import flash.utils.ByteArray;
+
public class SampleItem
{
View
5 awaybuilder-core/src/awaybuilder/model/vo/ScenegraphTreeVO.as
@@ -5,13 +5,16 @@ package awaybuilder.model.vo
[Bindable]
public class ScenegraphTreeVO
{
- public function ScenegraphTreeVO( label:String )
+ public function ScenegraphTreeVO( label:String, item:Object )
{
this.label = label;
+ this.item = item;
}
public var label:String;
+ public var item:Object;
+
public var children:ArrayCollection;
}
View
21 awaybuilder-core/src/awaybuilder/scene/controllers/Scene3DManager.as
@@ -136,7 +136,7 @@ package awaybuilder.scene.controllers
scope.addEventListener(MouseEvent.MOUSE_OUT, instance.onMouseOut);
scope.addEventListener(Event.RESIZE, instance.handleScreenSize);
- instance.handleScreenSize();
+ instance.resize();
stage3DProxy.addEventListener(Event.ENTER_FRAME, instance.loop);
@@ -153,19 +153,28 @@ package awaybuilder.scene.controllers
private function handleScreenSize(e:Event=null):void
{
+// resize();
+ scope.addEventListener(Event.ENTER_FRAME, validateSizeOnNextFrame );
+ }
+ private function validateSizeOnNextFrame( e:Event ):void
+ {
+ resize();
+ }
+ private function resize():void
+ {
+ scope.addEventListener(Event.ENTER_FRAME, validateSizeOnNextFrame );
orientationTool.x = scope.width - orientationTool.width - 10;
orientationTool.y = 5;
- stage3DProxy.x = scope.x;
- stage3DProxy.y = scope.localToGlobal(new Point(scope.x, scope.y)).y;
+ var position:Point = scope.localToGlobal(new Point(0, 0));
+ stage3DProxy.x = position.x;
+ stage3DProxy.y = position.y;
stage3DProxy.width = scope.width;
stage3DProxy.height = scope.height;
view.width = scope.width;
view.height = scope.height;
- }
-
-
+ }
// Mouse Events *************************************************************************************************************************************************
View
52 awaybuilder-core/src/awaybuilder/utils/ZoomUtil.as
@@ -1,52 +0,0 @@
-package awaybuilder.utils
-{
- public class ZoomUtil
- {
- private static const ZOOM_PRESETS:Vector.<Number> = new <Number>
- [
- 0.25,
- 0.33,
- 0.5,
- 0.67,
- 1,
- 2,
- 3,
- 4,
- 5
- ];
-
- public static function getNextHighestZoomPreset(value:Number):Number
- {
- const presetCount:int = ZOOM_PRESETS.length;
- var presetIndex:int = presetCount - 1;
- for(var i:int = 0; i < presetCount; i++)
- {
- var presetValue:Number = ZOOM_PRESETS[i];
- if((presetValue - 0.01) > value)
- {
- presetIndex = i;
- break;
- }
- }
-
- return ZOOM_PRESETS[presetIndex];
- }
-
- public static function getNextLowestZoomPreset(value:Number):Number
- {
- var presetIndex:int = 0;
- const presetCount:int = ZOOM_PRESETS.length;
- for(var i:int = presetCount - 1; i >= 0; i--)
- {
- var presetValue:Number = ZOOM_PRESETS[i];
- if((presetValue + 0.01) < value)
- {
- presetIndex = i;
- break;
- }
- }
-
- return ZOOM_PRESETS[presetIndex];
- }
- }
-}
View
18 awaybuilder-core/src/awaybuilder/utils/logging/ArrayUtil.as
@@ -0,0 +1,18 @@
+package awaybuilder.utils.logging
+{
+ public class ArrayUtil
+ {
+ public static function vectorEqualToArray(a:Vector.<Object>, b:Array):Boolean {
+ if(a.length != b.length) {
+ return false;
+ }
+ var len:int = a.length;
+ for(var i:int = 0; i < len; i++) {
+ if(a[i] !== b[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+}
View
29 ...der-core/src/awaybuilder/printing/FlexPrintJob.as → ...re/src/awaybuilder/utils/printing/FlexPrintJob.as
@@ -1,15 +1,4 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// ADOBE SYSTEMS INCORPORATED
-// Copyright 2005-2007 Adobe Systems Incorporated
-// All Rights Reserved.
-//
-// NOTICE: Adobe permits you to use, modify, and distribute this file
-// in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package awaybuilder.printing
+package awaybuilder.utils.printing
{
import flash.display.DisplayObject;
@@ -29,22 +18,6 @@ package awaybuilder.printing
use namespace mx_internal;
- /**
- * The FlexPrintJob class is a wrapper for the flash.printing.PrintJob class.
- * It supports automatically slicing and paginating the output on multilple pages,
- * and scaling the grid contents to fit the printer's page size.
- *
- * @includeExample examples/FormPrintHeader.mxml -noswf
- * @includeExample examples/FormPrintFooter.mxml -noswf
- * @includeExample examples/FormPrintView.mxml -noswf
- * @includeExample examples/PrintDataGridExample.mxml
- *
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
public class FlexPrintJob
{
View
16 awaybuilder-core/src/awaybuilder/utils/sliderValueToZoomValue.as
@@ -1,16 +0,0 @@
-package awaybuilder.utils
-{
- public function sliderValueToZoomValue(sliderValue:Number):Number
- {
- var zoomValue:Number;
- if(sliderValue < 1)
- {
- zoomValue = 0.25 + 0.75 * sliderValue;
- }
- else
- {
- zoomValue = 1 + 4 * (sliderValue - 1);
- }
- return int(zoomValue * 100) / 100;
- }
-}
View
11 awaybuilder-core/src/awaybuilder/utils/zoomValueToSliderValue.as
@@ -1,11 +0,0 @@
-package awaybuilder.utils
-{
- public function zoomValueToSliderValue(zoomValue:Number):Number
- {
- if(zoomValue < 1)
- {
- return (zoomValue - 0.25) / 0.75;
- }
- return ((zoomValue - 1) / 4) + 1;
- }
-}
View
86 awaybuilder-core/src/awaybuilder/view/components/CollapsiblePanel.as
@@ -0,0 +1,86 @@
+package awaybuilder.view.components
+{
+ import flash.events.Event;
+ import flash.events.MouseEvent;
+
+ import spark.components.Panel;
+ import spark.components.supportClasses.ButtonBase;
+ import spark.components.supportClasses.ToggleButtonBase;
+
+ [Event(name="collapsedChange",type="flash.events.Event")]
+
+ [SkinState("collapsed")]
+ public class CollapsiblePanel extends Panel
+ {
+ public function CollapsiblePanel()
+ {
+ super();
+ }
+
+ [SkinPart(required="false")]
+ public var collapseButton:ButtonBase;
+
+ protected var collapsedChanged:Boolean = false;
+
+ private var _collapsed:Boolean = false;
+
+ [Bindable("collapsedChange")]
+ public function get collapsed():Boolean
+ {
+ return this._collapsed;
+ }
+
+ public function set collapsed(value:Boolean):void
+ {
+ if(this._collapsed === value)
+ {
+ return;
+ }
+ this._collapsed = value;
+ this.collapsedChanged = true;
+ this.invalidateProperties();
+ this.invalidateSkinState();
+ this.dispatchEvent(new Event("collapsedChange"));
+ }
+
+ override protected function commitProperties():void
+ {
+ if(this.collapsedChanged)
+ {
+ if(this.collapseButton && this.collapseButton is ToggleButtonBase)
+ {
+ ToggleButtonBase(this.collapseButton).selected = this.collapsed;
+ }
+ this.collapsedChanged = false;
+ }
+ super.commitProperties();
+ }
+
+ override protected function partAdded(partName:String, instance:Object):void
+ {
+ if(instance == this.collapseButton)
+ {
+ this.collapseButton.addEventListener(MouseEvent.CLICK, collapseButton_clickHandler);
+ }
+ }
+
+ override protected function partRemoved(partName:String, instance:Object):void
+ {
+ if(instance == this.collapseButton)
+ {
+ this.collapseButton.removeEventListener(MouseEvent.CLICK, collapseButton_clickHandler);
+ }
+ }
+
+ override protected function getCurrentSkinState():String
+ {
+ return this.collapsed ? "collapsed" : super.getCurrentSkinState();
+ }
+
+ protected function collapseButton_clickHandler(event:MouseEvent):void
+ {
+ this.collapsed = !this.collapsed;
+ }
+
+ }
+}
View
76 awaybuilder-core/src/awaybuilder/view/components/CoreEditor.mxml
@@ -2,11 +2,11 @@
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
- backgroundAlpha="0"
- creationComplete="skinnablecontainer1_creationCompleteHandler(event)"
+ backgroundAlpha="0"
xmlns:flextoolbox="library://ns.flextoolbox.com/flex"
xmlns:components="awaybuilder.view.components.*"
- xmlns:tree="awaybuilder.view.components.tree.*">
+ xmlns:tree="awaybuilder.view.components.tree.*"
+ tabChildren="false" tabEnabled="false" xmlns:propertyEditors="awaybuilder.view.components.propertyEditors.*">
<s:layout>
<s:VerticalLayout gap="0" paddingTop="0" paddingRight="0" paddingBottom="0" paddingLeft="0"/>
@@ -15,7 +15,10 @@
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
- import mx.events.FlexEvent;
+
+ import spark.events.IndexChangeEvent;
+
+ import awaybuilder.view.components.events.CoreEditorEvent;
[Bindable] public var scenegraph:ArrayCollection;
@@ -31,26 +34,31 @@
// return getQualifiedClassName(item).split("::")[1];
// }
-// protected function handleScene3DManagerSelection(event:awaybuilder.scene.events.Scene3DManagerEvent):void
+// protected function handleObjectSelection(e:MouseEvent):void
// {
-// var items:Vector.<Object> = new Vector.<Object>();
-// for (var i:int=0;i<Scene3DManager.selectedObjects.length;i++)
-// {
-// items.push(Scene3DManager.selectedObjects.getItemAt(i));
-// }
-// objectsGrid.selectedItems = items;
-// }
- protected function handleObjectSelection(e:MouseEvent):void
- {
// Scene3DManager.selectObjectByName(objectsGrid.selectedItem.name);
- }
+// }
+
+
+ protected function tree_changeHandler(event:IndexChangeEvent):void
+ {
+ this.dispatchEvent( new CoreEditorEvent( CoreEditorEvent.TREE_CHANGE, tree.selectedItems ) );
+ }
- protected function skinnablecontainer1_creationCompleteHandler(event:FlexEvent):void
+ protected function collapseButton_clickHandler(event:MouseEvent):void
+ {
+ tree.collapseAll();
+ collapseButton.visible = false;
+ expandButton.visible = true;
+ }
+ protected function expandButton_clickHandler(event:MouseEvent):void
{
-// Scene3DManager.instance.addEventListener(Scene3DManagerEvent.MESH_SELECTED, handleScene3DManagerSelection);
-
+ tree.expandAll();
+ collapseButton.visible = true;
+ expandButton.visible = false;
}
+
]]>
</fx:Script>
<components:EditToolBar id="editToolbar" width="100%"/>
@@ -60,17 +68,37 @@
<s:HorizontalLayout gap="0"/>
</s:layout>
- <!--<components:ObjectPicker id="objectPicker" height="100%" depth="1"/>-->
- <s:Panel width="300" height="100%" styleName="toolsPanel" title="Scene Graph" alpha="1">
+ <components:CollapsiblePanel height="100%" styleName="scenePanel" chromeColor="0x1d1d1c" color="0xdbdbdb" fontSize="11"
+ skinClass="awaybuilder.view.skins.CollapsiblePanelSkin"
+ >
+ <s:HGroup width="100%" verticalAlign="middle" paddingLeft="6" paddingRight="2" paddingTop="2" paddingBottom="2" height="23">
+ <s:Label width="100%" text="Library" fontWeight="bold"/>
+ <s:Button id="collapseButton" label="collapse all" height="19" visible="false" includeInLayout="{collapseButton.visible}"
+ click="collapseButton_clickHandler(event)"/>
+ <s:Button id="expandButton" label="expand all" height="19" visible="false" includeInLayout="{expandButton.visible}"
+ click="expandButton_clickHandler(event)"/>
+ <!--<s:ToggleButton id="disclosureButton"
+ skinClass="awaybuilder.view.components.tree.TreeDisclosureButtonSkin"/>-->
+ </s:HGroup>
<tree:Tree id="tree" dataProvider="{scenegraph}" borderVisible="false" skinClass="awaybuilder.view.skins.TreeSkin"
- labelField="label"
- width="100%" height="100%" textRollOverColor="yellow"
+ labelField="label" change="tree_changeHandler(event)"
+ width="250" height="100%" textRollOverColor="yellow"
textSelectedColor="0xFFFFFF" dragEnabled="false" dropEnabled="false"
dragMoveEnabled="true">
</tree:Tree>
- </s:Panel>
+ </components:CollapsiblePanel>
+
+ <mx:UIComponent id="scope" width="100%" height="100%"/>
- <mx:UIComponent id="viewPort" width="100%" height="100%"/>
+ <components:CollapsiblePanel id="propertiesPanel" visible="false" includeInLayout="{propertiesPanel.visible}" height="100%" styleName="propertiesPanel" chromeColor="0x1d1d1c" color="0xdbdbdb" fontSize="11"
+ skinClass="awaybuilder.view.skins.CollapsibleRightPanelSkin"
+
+ >
+ <s:Scroller width="210" height="100%">
+ <propertyEditors:MeshPropertyEditor width="100%"/>
+ </s:Scroller>
+
+ </components:CollapsiblePanel>
<!--<components:EditingSurface id="editor" width="100%" height="100%"/>-->
</s:Group>
View
54 awaybuilder-core/src/awaybuilder/view/components/EditStatusBar.mxml
@@ -10,30 +10,30 @@
[Event(name="zoom",type="awaybuilder.view.components.events.ToolBarZoomEvent")]
</fx:Metadata>
- <mx:Spacer width="100%"/>
+ <s:Spacer width="100%"/>
- <s:Button id="zoomOutButton" styleName="toolbarButton" toolTip="Zoom Out"
- click="zoomOutButton_clickHandler(event)"/>
- <s:HSlider id="zoomSlider" minimum="0" maximum="2" stepSize="0.0005" value="1"
- liveDragging="true"
+ <s:Button id="zoomOutButton" styleName="toolbarButton" toolTip="Zoom Out" autoRepeat="true"
+ buttonDown="zoomOutButton_clickHandler(event)"/>
+ <s:HSlider id="zoomSlider" minimum="0" maximum="1" stepSize="0.001" value="0.9"
+ liveDragging="true" focusEnabled="false"
dataTipFormatFunction="{zoomSlider_dataTipFormat}"
change="zoomSlider_changeHandler(event)"/>
- <s:Button id="zoomInButton" styleName="toolbarButton" toolTip="Zoom In"
- click="zoomInButton_clickHandler(event)"/>
+ <s:Button id="zoomInButton" styleName="toolbarButton" toolTip="Zoom In" autoRepeat="true"
+ buttonDown="zoomInButton_clickHandler(event)"/>
<fx:Script>
<![CDATA[
- import awaybuilder.utils.sliderValueToZoomValue;
- import awaybuilder.utils.zoomValueToSliderValue;
+ import mx.events.FlexEvent;
+
import awaybuilder.view.components.events.ToolBarZoomEvent;
public function get zoom():Number
{
if(!this.zoomSlider)
{
- return 1;
+ return 1000;
}
- return sliderValueToZoomValue(this.zoomSlider.value);
+ return this.zoomSlider.value;
}
public function set zoom(value:Number):void
@@ -42,33 +42,31 @@
{
return;
}
- this.zoomSlider.value = zoomValueToSliderValue(value);
+ this.zoomSlider.value = value;
}
- protected function editor_mouseWheelHandler(event:MouseEvent):void
- {
- this.zoomSlider.value += event.delta * 0.05;
- }
-
private function zoomSlider_dataTipFormat(value:Number):String
{
- if(value >= 1)
- {
- value = 1 + 4 * (value - 1);
- }
- else
- {
- value = 0.25 + 0.75 * value;
- }
- return int(value * 100) + "%";
+
+// if(value >= 1)
+// {
+// value = 1 + 4 * (value - 1);
+// }
+// else
+// {
+// value = 0.25 + 0.75 * value;
+// }
+// return int(value * 100) + "%";
+
+ return (Math.round((1-value)*10000)).toString();
}
- protected function zoomInButton_clickHandler(event:MouseEvent):void
+ protected function zoomInButton_clickHandler(event:FlexEvent):void
{
this.dispatchEvent(new ToolBarZoomEvent(ToolBarZoomEvent.ZOOM_IN));
}
- protected function zoomOutButton_clickHandler(event:MouseEvent):void
+ protected function zoomOutButton_clickHandler(event:FlexEvent):void
{
this.dispatchEvent(new ToolBarZoomEvent(ToolBarZoomEvent.ZOOM_OUT));
}
View
15 awaybuilder-core/src/awaybuilder/view/components/EditToolBar.mxml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx">
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:components="awaybuilder.view.components.*">
<fx:Metadata>
[Event(name="newDocument",type="awaybuilder.view.components.events.ToolBarEvent")]
@@ -38,9 +38,9 @@
<mx:VRule styleName="toolbarSeparator" height="21"/>
<!-- camera modes -->
- <s:RadioButton id="targetCameraButton" styleName="toolbarButton" toolTip="Target Camera Mode" value="Target"
+ <components:SwitchButton id="targetCameraButton" styleName="toolbarButton" toolTip="Target Camera Mode" value="Target" tabFocusEnabled="false" tabEnabled="false" tabChildren="false" focusEnabled="false"
selected="true" group="{cameraModeToolGroup}"/>
- <s:RadioButton id="freeCameraButton" styleName="toolbarButton" toolTip="Free Camera Mode" value="Free"
+ <components:SwitchButton id="freeCameraButton" styleName="toolbarButton" toolTip="Free Camera Mode" value="Free" tabFocusEnabled="false" tabEnabled="false" tabChildren="false"
group="{cameraModeToolGroup}"/>
<mx:VRule styleName="toolbarSeparator" height="21"/>
@@ -74,11 +74,11 @@
click="rotateClockwiseButton_clickHandler(event)"/>-->
<mx:VRule styleName="toolbarSeparator" height="21"/>
<!-- transform modes -->
- <s:RadioButton id="translateButton" styleName="toolbarButton" toolTip="Translate Transform Mode" value="Translate"
+ <components:SwitchButton id="translateButton" styleName="toolbarButton" toolTip="Translate Transform Mode" value="Translate"
selected="true" group="{transformModeToolGroup}"/>
- <s:RadioButton id="rotateButton" styleName="toolbarButton" toolTip="Rotate Transform Mode" value="Rotate"
+ <components:SwitchButton id="rotateButton" styleName="toolbarButton" toolTip="Rotate Transform Mode" value="Rotate"
group="{transformModeToolGroup}"/>
- <s:RadioButton id="scaleButton" styleName="toolbarButton" toolTip="Scale Transform Mode" value="Scale"
+ <components:SwitchButton id="scaleButton" styleName="toolbarButton" toolTip="Scale Transform Mode" value="Scale"
group="{transformModeToolGroup}"/>
<mx:VRule styleName="toolbarSeparator" height="21"/>
@@ -275,6 +275,7 @@
this.dispatchEvent(new ToolBarEvent(ToolBarEvent.DOCUMENT_SETTINGS));
}
+
]]>
</fx:Script>
</s:SkinnableContainer>
View
101 awaybuilder-core/src/awaybuilder/view/components/EditorGrid.as
@@ -1,101 +0,0 @@
-package awaybuilder.view.components
-{
- import flash.display.CapsStyle;
- import flash.display.LineScaleMode;
- import flash.events.Event;
-
- import mx.core.UIComponent;
-
- [Style(name="gridColor",type="uint")]
-
- //TODO: why [ExcludeClass] ?
-
- public class EditorGrid extends UIComponent
- {
- public function EditorGrid()
- {
- super();
- this.mouseEnabled = this.mouseChildren = false;
- }
-
- private var _gridSize:Number = 10;
-
- [Bindable("gridSizeChange")]
- public function get gridSize():Number
- {
- return this._gridSize;
- }
-
- public function set gridSize(value:Number):void
- {
- if(this._gridSize == value)
- {
- return;
- }
- this._gridSize = value;
- this.invalidateDisplayList();
- this.dispatchEvent(new Event("gridSizeChange"));
- }
-
- private var _xOffset:Number = 0;
-
- [Bindable("xOffsetChange")]
- public function get xOffset():Number
- {
- return this._xOffset;
- }
-
- public function set xOffset(value:Number):void
- {
- if(this._xOffset == value)
- {
- return;
- }
- this._xOffset = value;
- this.invalidateDisplayList();
- this.dispatchEvent(new Event("xOffsetChange"));
- }
-
- private var _yOffset:Number = 0;
-
- [Bindable("yOffsetChange")]
- public function get yOffset():Number
- {
- return this._yOffset;
- }
-
- public function set yOffset(value:Number):void
- {
- if(this._yOffset == value)
- {
- return;
- }
- this._yOffset = value;
- this.invalidateDisplayList();
- this.dispatchEvent(new Event("yOffsetChange"));
- }
-
- override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
- {
- super.updateDisplayList(unscaledWidth, unscaledHeight);
-
- this.graphics.clear();
-
- const gridColor:uint = this.getStyle("gridColor");
- this.graphics.lineStyle(0, gridColor, 1, true, LineScaleMode.NONE, CapsStyle.SQUARE);
-
- var start:Number = this._xOffset == 0 ? 0 : (this._gridSize - this._xOffset);
- for(var i:int = -this._xOffset; i <= unscaledWidth; i+= this._gridSize)
- {
- this.graphics.moveTo(i, 0);
- this.graphics.lineTo(i, unscaledHeight);
- }
- start = this._yOffset == 0 ? 0 : (this._gridSize - this._yOffset);
- for(i = -this._yOffset; i <= unscaledHeight; i+= this._gridSize)
- {
- this.graphics.moveTo(0, i);
- this.graphics.lineTo(unscaledWidth, i);
- }
- }
- }
-}
View
20 awaybuilder-core/src/awaybuilder/view/components/SwitchButton.as
@@ -0,0 +1,20 @@
+package awaybuilder.view.components
+{
+ import flash.events.KeyboardEvent;
+
+ import spark.components.RadioButton;
+
+ public class SwitchButton extends RadioButton
+ {
+ public function SwitchButton()
+ {
+ super();
+ }
+
+ override protected function keyDownHandler(event:KeyboardEvent):void
+ {
+ if (event.isDefaultPrevented())
+ return;
+ }
+ }
+}
View
18 awaybuilder-core/src/awaybuilder/view/components/events/CoreEditorEvent.as
@@ -0,0 +1,18 @@
+package awaybuilder.view.components.events
+{
+ import flash.events.Event;
+
+ public class CoreEditorEvent extends Event
+ {
+ public static const TREE_CHANGE:String = "treeChange";
+
+ public function CoreEditorEvent(type:String, data:Object )
+ {
+ super(type, false, false);
+ this.data = data;
+ }
+
+ public var data:Object;
+
+ }
+}
View
13 awaybuilder-core/src/awaybuilder/view/components/propertyEditors/IObjectPropertyEditor.as
@@ -1,13 +0,0 @@
-package awaybuilder.view.components.propertyEditors
-{
- import mx.core.IUIComponent;
- import mx.core.IVisualElement;
- import mx.managers.IFocusManagerComponent;
- import mx.styles.IStyleClient;
-
- public interface IObjectPropertyEditor extends IVisualElement, IUIComponent, IFocusManagerComponent, IStyleClient
- {
-// function get object():IEditorObjectView
-// function set object(value:IEditorObjectView):void;
- }
-}
View
73 awaybuilder-core/src/awaybuilder/view/components/propertyEditors/MeshPropertyEditor.mxml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx">
+ <s:layout>
+ <s:FormLayout/>
+ </s:layout>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+ <s:Form width="100%" height="100%" skinClass="awaybuilder.view.skins.PropertyFormSkin">
+ <s:HGroup width="100%" verticalAlign="middle" paddingLeft="6" paddingRight="6" paddingTop="6" paddingBottom="6" height="31">
+ <s:Label width="100%" text="Mesh Properties" fontWeight="bold"/>
+ <s:Button label="Focus"/>
+ <!--<s:ToggleButton id="disclosureButton"
+ skinClass="awaybuilder.view.components.tree.TreeDisclosureButtonSkin"/>-->
+ </s:HGroup>
+ <s:FormItem label="Position" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:Button label="Select..." width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Pivot Point" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:Button label="Select..." width="100%"/>
+ </s:FormItem>
+
+ <s:FormItem label="Rotation X" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:NumericStepper minimum="-999999" maximum="999999" width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Rotation Y" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:NumericStepper minimum="-999999" maximum="999999" width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Rotation Z" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:NumericStepper minimum="-999999" maximum="999999" width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Scale X" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:NumericStepper minimum="-999999" maximum="999999" width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Scale Y" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:NumericStepper minimum="-999999" maximum="999999" width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Scale Z" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:NumericStepper minimum="-999999" maximum="999999" width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Children" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:Button label="Select..." width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Extra" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:Button label="Select..." width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Material" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:DropDownList width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Geometry" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:DropDownList width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Animator" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:DropDownList width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Name" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:TextInput width="100%"/>
+ </s:FormItem>
+ <s:FormItem label="Cast Shadows" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:CheckBox/>
+ </s:FormItem>
+ <s:FormItem label="Sub Meshes" skinClass="awaybuilder.view.skins.PropertyFormItemSkin" width="100%">
+ <s:Button label="Submesh1" width="100%"/>
+ <s:Button label="Submesh2" width="100%"/>
+ <s:Button label="Submesh3" width="100%"/>
+ </s:FormItem>
+
+ </s:Form>
+
+
+</s:Group>
View
90 awaybuilder-core/src/awaybuilder/view/components/propertyEditors/ShapePropertyEditor.mxml
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<mx:Form xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- width="100%" height="100%" minHeight="300" focusRect="false"
- implements="awaybuilder.view.components.propertyEditors.IObjectPropertyEditor">
-
- <fx:Metadata>
- [Event(name="change",type="flash.events.Event")]
- </fx:Metadata>
-
- <fx:Declarations>
- </fx:Declarations>
-
- <mx:FormItem label="Position" direction="horizontal">
- <s:TextInput id="xInput" restrict="0-9"/>
- <s:TextInput id="yInput" restrict="0-9"/>
- </mx:FormItem>
-
- <mx:FormItem label="Size" direction="horizontal">
- <s:TextInput id="widthInput" restrict="0-9"/>
- <s:TextInput id="heightInput" restrict="0-9"/>
- </mx:FormItem>
-
- <mx:FormItem label="Color">
- <mx:ColorPicker id="colorPicker" width="100%"/>
- </mx:FormItem>
-
- <fx:Script>
- <![CDATA[
-
- protected var objectChanged:Boolean = false;
-
-// private var _object:IEditorObjectView;
-//
-// public function get object():IEditorObjectView
-// {
-// return this._object;
-// }
-//
-// public function set object(value:IEditorObjectView):void
-// {
-// if(this._object == value)
-// {
-// return;
-// }
-// this._object = value;
-// this.objectChanged = true;
-// this.invalidateProperties();
-// }
-//
-// override protected function commitProperties():void
-// {
-// if(this.objectChanged)
-// {
-// var shape:ShapeView = this.object as ShapeView;
-// if(shape)
-// {
-// this.xInput.text = shape.x.toString();
-// this.xInput.enabled = true;
-// this.yInput.text = shape.y.toString();
-// this.yInput.enabled = true;
-// this.widthInput.text = shape.width.toString();
-// this.widthInput.enabled = true;
-// this.heightInput.text = shape.height.toString();
-// this.heightInput.enabled = true;
-// this.colorPicker.selectedColor = shape.color;
-// this.colorPicker.enabled = true;
-// }
-// else
-// {
-// this.xInput.text = "";
-// this.xInput.enabled = false;
-// this.yInput.text = "";
-// this.yInput.enabled = false;
-// this.widthInput.text = "";
-// this.widthInput.enabled = false;
-// this.heightInput.text = "";
-// this.heightInput.enabled = false;
-// this.colorPicker.selectedColor = 0x000000;
-// this.colorPicker.enabled = false;
-// }
-// this.objectChanged = false;
-// }
-// super.commitProperties();
-// }
-
- ]]>
- </fx:Script>
-</mx:Form>
View
26 awaybuilder-core/src/awaybuilder/view/components/tree/Tree.as
@@ -380,6 +380,32 @@ package awaybuilder.view.components.tree
getStyle("folderClosedIcon") || getStyle("defaultLeafIcon");
}
+ public function expandAll():void
+ {
+ for( var i:int = 0; i < dataProvider.length; i++ )
+ {
+ var item:Object = dataProvider.getItemAt( i );
+ if (dataDescriptor.hasChildren(item))
+ {
+ var children:IList = IList(dataDescriptor.getChildren(item));
+ _dataProvider.openBranch(children, item, true);
+ }
+ }
+ }
+
+ public function collapseAll():void
+ {
+ for( var i:int = 0; i < dataProvider.length; i++ )
+ {
+ var item:Object = dataProvider.getItemAt( i );
+ if (dataDescriptor.hasChildren(item))
+ {
+ var children:IList = IList(dataDescriptor.getChildren(item));
+ _dataProvider.closeBranch(children, item, true);
+ }
+ }
+ }
+
public function expandItem(item:Object, open:Boolean = true, cancelable:Boolean = true):void
{
if (dataDescriptor.hasChildren(item))
View
26 awaybuilder-core/src/awaybuilder/view/components/tree/TreeItemRenderer.mxml
@@ -1,9 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<tree:TreeItemRendererBase xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" width="100%"
+ xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" autoDrawBackground="false"
doubleClick="treeitemrendererbase1_doubleClickHandler(event)" doubleClickEnabled="true" xmlns:tree="awaybuilder.view.components.tree.*">
+ <tree:states>
+ <s:State name="normal" />
+ <s:State name="hovered" />
+ <s:State name="selected" />
+ </tree:states>
+
<fx:Script>
<![CDATA[
protected function disclosureButton_clickHandler(event:MouseEvent):void
@@ -22,12 +28,24 @@
<tree:layout>
<s:HorizontalLayout paddingLeft="{indentation + 4}" verticalAlign="middle"
- paddingBottom="4" paddingTop="4"/>
+ paddingBottom="4" paddingTop="4" gap="1"/>
</tree:layout>
<s:ToggleButton id="disclosureButton" visible="{disclosureIconVisible}" click="disclosureButton_clickHandler(event)"
selected="{isOpen}" skinClass="awaybuilder.view.components.tree.TreeDisclosureButtonSkin"/>
-
- <s:Label id="labelDisplay" text="{label}" color="{textColor}"/>
+ <s:Group>
+ <s:Rect top="0" bottom="0" left="0" right="0" includeIn="hovered,selected" radiusX="2" radiusY="2" alpha.hovered="0.5">
+ <s:stroke>
+ <s:SolidColorStroke color="0x004F8F"/>
+ </s:stroke>
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="0x004F8F" alpha="0.1" ratio="0.2"/>
+ <s:GradientEntry color="0x004F8F" alpha="0.5" ratio="0.9"/>
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+ <s:Label id="labelDisplay" text="{label}" color="{textColor}" paddingTop="5" paddingBottom="4" paddingLeft="5" paddingRight="5" />
+ </s:Group>
</tree:TreeItemRendererBase>
View
135 awaybuilder-core/src/awaybuilder/view/mediators/CoreEditorMediator.as
@@ -1,14 +1,24 @@
package awaybuilder.view.mediators
{
+ import flash.events.ErrorEvent;
import flash.events.Event;
+ import flash.events.UncaughtErrorEvent;
+
+ import mx.controls.Alert;
+ import mx.core.FlexGlobals;
+
+ import away3d.entities.Mesh;
import awaybuilder.events.DocumentModelEvent;
- import awaybuilder.events.EditorStateChangeEvent;
+ import awaybuilder.events.SceneEvent;
import awaybuilder.model.IDocumentModel;
import awaybuilder.model.ISettingsModel;
+ import awaybuilder.model.vo.ScenegraphTreeVO;
import awaybuilder.scene.controllers.Scene3DManager;
import awaybuilder.scene.events.Scene3DManagerEvent;
+ import awaybuilder.utils.logging.ArrayUtil;
import awaybuilder.view.components.CoreEditor;
+ import awaybuilder.view.components.events.CoreEditorEvent;
import org.robotlegs.mvcs.Mediator;
@@ -25,24 +35,135 @@ package awaybuilder.view.mediators
override public function onRegister():void
{
+ FlexGlobals.topLevelApplication.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
+
Scene3DManager.instance.addEventListener(Scene3DManagerEvent.READY, scene_readyHandler);
- Scene3DManager.init( view.viewPort );
-// view.scenegraph = document.scenegraph;
+ Scene3DManager.instance.addEventListener(Scene3DManagerEvent.MESH_SELECTED, scene_meshSelectedHandler);
+ Scene3DManager.init( view.scope );
+
+ this.view.addEventListener( CoreEditorEvent.TREE_CHANGE, view_treeChangeHandler );
this.eventMap.mapListener(this.eventDispatcher, DocumentModelEvent.DOCUMENT_UPDATED, eventDispatcher_documentUpdatedHandler);
+ this.eventMap.mapListener(this.eventDispatcher, SceneEvent.ITEMS_SELECT, eventDispatcher_itemsSelectHandler);
}
- protected function scene_readyHandler(event:Event):void
+ //----------------------------------------------------------------------
+ //
+ // view handlers
+ //
+ //----------------------------------------------------------------------
+
+ private function view_treeChangeHandler(event:CoreEditorEvent):void
{
- }
+ var items:Vector.<Object> = new Vector.<Object>();
+ var selectedItems:Vector.<Object> = event.data as Vector.<Object>;
+ for (var i:int=0;i<selectedItems.length;i++)
+ {
+ items.push(ScenegraphTreeVO(selectedItems[i]).item);
+ }
+ trace( items );
+
+
+
+ this.dispatch(new SceneEvent(SceneEvent.ITEMS_SELECT,items));
+ }
- protected function eventDispatcher_documentUpdatedHandler(event:DocumentModelEvent):void
+ //----------------------------------------------------------------------
+ //
+ // robotlegs handlers
+ //
+ //----------------------------------------------------------------------
+
+ private function eventDispatcher_documentUpdatedHandler(event:DocumentModelEvent):void
{
- trace( "eventDispatcher_documentUpdatedHandler" );
view.scenegraph = document.scenegraph;
+ view.tree.expandAll();
+ view.expandButton.visible = false;
+ view.collapseButton.visible = true;
+ }
+
+ private function eventDispatcher_itemsSelectHandler(event:SceneEvent):void
+ {
+ if( event.items.length )
+ {
+ if( event.items.length == 1 )
+ {
+ if( event.items[0] is Mesh )
+ {
+ view.propertiesPanel.visible = true;
+ var m:Mesh = event.items[0] as Mesh;
+ Scene3DManager.selectObjectByName(m.name);
+ }
+ else {
+ view.propertiesPanel.visible = false;
+ }
+ }
+ else
+ {
+ view.propertiesPanel.visible = false;
+ }
+
+ }
+ else
+ {
+ view.propertiesPanel.visible = false;
+ }
+
+ }
+
+ //----------------------------------------------------------------------
+ //
+ // scene handlers
+ //
+ //----------------------------------------------------------------------
+
+ private function scene_readyHandler(event:Event):void
+ {
+
}
+ private function scene_meshSelectedHandler(event:Scene3DManagerEvent):void
+ {
+ if( ArrayUtil.vectorEqualToArray( document.selectedObjects, Scene3DManager.selectedObjects.source ) )
+ {
+ return;
+ }
+
+ var items:Vector.<Object> = new Vector.<Object>();
+ for (var i:int=0;i<Scene3DManager.selectedObjects.length;i++)
+ {
+ items.push(Scene3DManager.selectedObjects.getItemAt(i));
+ }
+ trace( items );
+ document.selectedObjects = items;
+ this.dispatch(new SceneEvent(SceneEvent.ITEMS_SELECT,items));
+ }
+
+ //----------------------------------------------------------------------
+ //
+ // uncaught Error Handler
+ //
+ //----------------------------------------------------------------------
+
+ private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
+ {
+ event.preventDefault();
+ if (event.error is Error)
+ {
+ var error:Error = event.error as Error;
+ Alert.show( error.message, error.name );
+ }
+ else if (event.error is ErrorEvent)
+ {
+ var errorEvent:ErrorEvent = event.error as ErrorEvent;
+ Alert.show( errorEvent.text, errorEvent.type );
+ }
+ else
+ {
+ Alert.show( event.text, event.type );
+ }
+ }
}
}
View
9 awaybuilder-core/src/awaybuilder/view/mediators/EditStatusBarMediator.as
@@ -2,7 +2,7 @@ package awaybuilder.view.mediators
{
import awaybuilder.events.EditorStateChangeEvent;
import awaybuilder.model.IEditorModel;
- import awaybuilder.utils.ZoomUtil;
+ import awaybuilder.scene.controllers.CameraManager;
import awaybuilder.view.components.EditStatusBar;
import awaybuilder.view.components.events.ToolBarZoomEvent;
@@ -23,11 +23,14 @@ package awaybuilder.view.mediators
this.eventMap.mapListener(this.statusBar, ToolBarZoomEvent.ZOOM_TO, statusBar_zoomToHandler);
this.eventMap.mapListener(this.eventDispatcher, EditorStateChangeEvent.ZOOM_CHANGE, eventDispatcher_zoomChangeHandler);
+
+ this.statusBar.zoom = this.editor.zoom;
}
private function eventDispatcher_zoomChangeHandler(event:EditorStateChangeEvent):void
{
this.statusBar.zoom = this.editor.zoom;
+ CameraManager.radius = (1-this.editor.zoom)*10000;
}
private function statusBar_zoomToHandler(event:ToolBarZoomEvent):void
@@ -37,12 +40,12 @@ package awaybuilder.view.mediators
private function statusBar_zoomInHandler(event:ToolBarZoomEvent):void
{
- this.statusBar.zoom = this.editor.zoom = ZoomUtil.getNextHighestZoomPreset(this.editor.zoom);
+ this.editor.zoom += 100/10000;
}
private function statusBar_zoomOutHandler(event:ToolBarZoomEvent):void
{
- this.statusBar.zoom = this.editor.zoom = ZoomUtil.getNextLowestZoomPreset(this.editor.zoom);
+ this.editor.zoom -= 100/10000;
}
}
}
View
2  awaybuilder-core/src/awaybuilder/view/mediators/SamplePickerMediator.as
@@ -30,7 +30,7 @@ package awaybuilder.view.mediators
private function picker_cancelHandler(event:Event):void
{
- this.dispatch(new HelpEvent(HelpEvent.HIDE_SAMPLES));
+ this.dispatch(new HelpEvent(HelpEvent.HIDE_WELCOME));
}
private function showAtStartupCheck_changeHandler(event:Event):void
View
7 ...er/view/skins/ObjectPickerCollapseButtonSkin.mxml → ...waybuilder/view/skins/CollapseLeftButtonSkin.mxml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns