Skip to content

Commit

Permalink
fixed #202
Browse files Browse the repository at this point in the history
  • Loading branch information
keyemkey committed Jul 4, 2013
1 parent c0cdfa8 commit 9aee3c0
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ package awaybuilder.controller.scene
{
material.effectMethods.addItem(newValue);
}
material.fillFromMaterial( material );
}

commitHistoryEvent( event );
Expand Down
13 changes: 8 additions & 5 deletions awaybuilder-core/src/awaybuilder/model/AssetsModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ package awaybuilder.model
import away3d.materials.methods.NearShadowMapMethod;
import away3d.materials.methods.OutlineMethod;
import away3d.materials.methods.PhongSpecularMethod;
import away3d.materials.methods.ProjectiveTextureMethod;
import away3d.materials.methods.RefractionEnvMapMethod;
import away3d.materials.methods.RimLightMethod;
import away3d.materials.methods.ShadingMethodBase;
Expand Down Expand Up @@ -246,7 +247,13 @@ package awaybuilder.model
camera.x = camera.y = camera.z = 0;
return GetAsset(camera) as CameraVO;
}

public function CreateProjectiveTextureMethod( textureProjector:TextureProjectorVO ):EffectMethodVO
{
var method:EffectMethodBase = new ProjectiveTextureMethod( GetObject(textureProjector) as TextureProjector );
method.name = "ProjectiveTexture " + AssetUtil.GetNextId("ProjectiveTexture");

return GetAsset( method ) as EffectMethodVO;
}
public function CreateEffectMethod( type:String ):EffectMethodVO
{
var method:EffectMethodBase;
Expand All @@ -256,10 +263,6 @@ package awaybuilder.model
method = new LightMapMethod(GetObject(defaultTexture) as Texture2DBase);
method.name = "LightMap" + AssetUtil.GetNextId("LightMapMethod");
break;
case "ProjectiveTextureMethod":
// method = new ProjectiveTextureMethod();
// method.name = "ProjectiveTexture " + AssetUtil.GetNextId("ProjectiveTexture");
break;
case "RimLightMethod":
method = new RimLightMethod();
method.name = "RimLight" + AssetUtil.GetNextId("RimLightMethod");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,7 @@ package awaybuilder.model.vo.scene
this.specularTexture = asset.specularTexture;
this.specularMethod = asset.specularMethod;

var effects:Array = [];
for each( var effect:EffectMethodVO in asset.effectMethods )
{
effects.push( effect );
}
this.effectMethods = new ArrayCollection( effects );
this.effectMethods = new ArrayCollection( asset.effectMethods.source.concat() );

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
[Bindable]
public var cubeTextures:ArrayCollection;
[Bindable]
public var texturePojectors:ArrayCollection;
[Bindable]
public var lightPickers:ArrayCollection;
Expand Down Expand Up @@ -125,7 +128,7 @@
<editors:LightPickerPropertiesEditor prevSelected="{prevSelected}" data="{data}" includeIn="lightPicker,initAll" />
<editors:ContainerPropertiesEditor prevSelected="{prevSelected}" data="{data}" includeIn="container,initAll" />
<editors:ShadowMethodPropertyEditor prevSelected="{prevSelected}" data="{data}" includeIn="shadowMethod,initAll" />
<editors:EffectMethodPropertyEditor textures="{defaultableTextures}" cubeTextures="{cubeTextures}" prevSelected="{prevSelected}" data="{data}" includeIn="effectMethod,initAll" />
<editors:EffectMethodPropertyEditor textures="{defaultableTextures}" textureProjectors="{texturePojectors}" cubeTextures="{cubeTextures}" prevSelected="{prevSelected}" data="{data}" includeIn="effectMethod,initAll" />
<editors:ShadowMapperPropertyEditor prevSelected="{prevSelected}" data="{data}" includeIn="shadowMapper,initAll" />
<editors:ShadingPropertyEditor textures="{defaultableTextures}" cubeTextures="{cubeTextures}" prevSelected="{prevSelected}" data="{data}" includeIn="shadingMethod,initAll" />
<editors:GeometryPropertiesEditor prevSelected="{prevSelected}" data="{data}" includeIn="geometry,initAll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import awaybuilder.view.components.controls.events.ExtendedDropDownEvent;
import awaybuilder.view.components.editors.events.PropertyEditorEvent;
import mx.collections.ArrayCollection;
import mx.events.ColorPickerEvent;
import spark.events.IndexChangeEvent;
Expand All @@ -42,6 +43,8 @@
[Bindable] private var _selectedTexture:TextureVO;
[Bindable] public var textureProjectors:ArrayCollection;
override protected function validate():void
{
if( !(data is EffectMethodVO) ) return;
Expand Down Expand Up @@ -166,20 +169,20 @@
>
<s:dataProvider>
<s:ArrayList>
<fx:String>Add</fx:String>
<fx:String>Multiply</fx:String>
<fx:String>Mix</fx:String>
<fx:String>add</fx:String>
<fx:String>multiply</fx:String>
<fx:String>mix</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:DropDownList>
<s:HGroup width="100%">
<s:Label text="Texture Projector:" fontWeight="bold"/>
<controls:HorizontalFormSeparator/>
</s:HGroup>
<!--<s:DropDownList id="textureProjectorDropDownList" requireSelection="true" selectionColor="0x111111"
change="" width="100%"
>
</s:DropDownList>-->
<s:DropDownList id="textureProjectorDropDownList" requireSelection="true" selectionColor="0x111111"
change="value_changeHandler(event)" width="100%" selectedItem="@{_asset.textureProjector}"
dataProvider="{textureProjectors}">
</s:DropDownList>
</s:VGroup>

<s:VGroup width="100%" paddingLeft="10" includeIn="ColorMatrixMethod">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
<fx:Object label="SimpleWaterNormalMethod" value="SimpleWaterNormalMethod"/>
</s:ArrayCollection>
<fx:Component className="NewEffectPopup">
<s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer" chromeColor="0x1d1d1c" color="0xdbdbdb"
mouseDownOutside="close();">
<s:SkinnablePopUpContainer skinClass="awaybuilder.view.skins.LibrarySkinnablePopUpContainer" chromeColor="0x1d1d1c" color="0xdbdbdb" mouseDownOutside="close();">
<s:Button width="100%" label="New LightMapMethod" styleName="addItemButton" cornerRadius="0" click="close(true,'LightMapMethod')"/>
<s:Button width="100%" label="New ProjectiveTextureMethod" styleName="addItemButton" cornerRadius="0" click="close(true,'ProjectiveTextureMethod')"/>
<s:Button width="100%" label="New RimLightMethod" styleName="addItemButton" cornerRadius="0" click="close(true,'RimLightMethod')"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ package awaybuilder.view.mediators
import flash.events.Event;
import flash.geom.Vector3D;

import mx.charts.AreaChart;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.CloseEvent;
Expand Down Expand Up @@ -500,11 +501,18 @@ package awaybuilder.view.mediators
{
if( event.data == "ProjectiveTextureMethod" )
{
Alert.show( "TextureProjector is missing", "Warning" );
var textureProjectors:Vector.<AssetVO> = document.getAssetsByType( TextureProjectorVO );
if( textureProjectors.length == 0 )
{
Alert.show( "TextureProjector is missing", "Warning" );
}
else
{
this.dispatch(new SceneEvent(SceneEvent.ADD_NEW_EFFECT_METHOD,[view.data], assets.CreateProjectiveTextureMethod( textureProjectors[0] as TextureProjectorVO )));
}
return;
}
this.dispatch(new SceneEvent(SceneEvent.ADD_NEW_EFFECT_METHOD,[view.data], assets.CreateEffectMethod( event.data as String )));

}
private function view_materialRemoveEffectMetodHandler(event:PropertyEditorEvent):void
{
Expand Down Expand Up @@ -878,6 +886,14 @@ package awaybuilder.view.mediators
view.animators = new ArrayCollection(animators);
view.skeletons = new ArrayCollection(skeletons);

var texturePojectors:Array = [];
var texturePojectorsVector:Vector.<AssetVO> = document.getAssetsByType( TextureProjectorVO );
for each( asset in texturePojectorsVector )
{
texturePojectors.push( asset );
}
view.texturePojectors = new ArrayCollection( texturePojectors );

var materials:ArrayCollection = new ArrayCollection();
materials.addAll( document.materials );
materials.addItemAt( assets.defaultMaterial, 0 );
Expand Down

0 comments on commit 9aee3c0

Please sign in to comment.