diff --git a/src/alternativa/editor/PropGeneralPropertiesPanel.mxml b/src/alternativa/editor/PropGeneralPropertiesPanel.mxml
new file mode 100644
index 0000000..dd1b3b8
--- /dev/null
+++ b/src/alternativa/editor/PropGeneralPropertiesPanel.mxml
@@ -0,0 +1,49 @@
+
+
+
+
+ = new Vector.();
+
+ private function onCreationComplete():void
+ {
+ }
+
+ private function onCollisionChanged(param1:Event):void
+ {
+ for each(var prop:MeshProp in _selectedProps)
+ {
+ prop.collisionEnabled = this.collision.selected;
+ }
+ }
+
+ public function init(selectedProps:Set, collisionEnabled:Boolean) : void
+ {
+ _selectedProps.length = 0;
+ for(var prop:* in selectedProps)
+ {
+ if(prop is MeshProp && !(prop is Sprite3DProp))
+ {
+ _selectedProps.push(prop as MeshProp);
+ }
+ }
+
+ this.collision.selected = collisionEnabled;
+ }
+
+ ]]>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/alternativa/editor/SceneContainer.as b/src/alternativa/editor/SceneContainer.as
index 4c0ed90..8a3128a 100644
--- a/src/alternativa/editor/SceneContainer.as
+++ b/src/alternativa/editor/SceneContainer.as
@@ -34,6 +34,12 @@ package alternativa.editor
public class SceneContainer extends UIComponent
{
+ private static var _instance:SceneContainer;
+ public static function get instance() : SceneContainer
+ {
+ return _instance;
+ }
+
private static const cameraPoint:Point3D = new Point3D(0,0,1000);
private static const cameraOffset:Point3D = new Point3D();
@@ -100,6 +106,7 @@ package alternativa.editor
public function SceneContainer()
{
+ _instance = this;
this.multiplePropMode = MultiPropMode.NONE;
this.mouseDownPoint = new Point();
this.rectProps = new Set();
diff --git a/src/alternativa/editor/mapexport/TanksXmlExporterV1Lite.as b/src/alternativa/editor/mapexport/TanksXmlExporterV1Lite.as
index 6097d5e..7f87eff 100644
--- a/src/alternativa/editor/mapexport/TanksXmlExporterV1Lite.as
+++ b/src/alternativa/editor/mapexport/TanksXmlExporterV1Lite.as
@@ -236,6 +236,10 @@ package alternativa.editor.mapexport
protected function createTileCollisionXml(param1:MeshProp, param2:XML) : void
{
+ if(!param1.collisionEnabled)
+ {
+ return;
+ }
var loc4:CollisionPrimitive = null;
var loc3:Vector. = this.collPrimCache.getPrimitives(param1.libraryName,param1.groupName,param1.name);
if(loc3 == null)
diff --git a/src/alternativa/editor/prop/MeshProp.as b/src/alternativa/editor/prop/MeshProp.as
index 85719df..cfa2293 100644
--- a/src/alternativa/editor/prop/MeshProp.as
+++ b/src/alternativa/editor/prop/MeshProp.as
@@ -20,6 +20,11 @@ package alternativa.editor.prop
public class MeshProp extends Prop
{
+ [Embed(source="no_collision_texture.png")]
+ private static const NO_COLLISION_TEXTURE_MASK_Class:Class;
+
+ private static const NO_COLLISION_TEXTURE_Bitmap:BitmapData = new NO_COLLISION_TEXTURE_MASK_Class().bitmapData;
+
public var bitmaps:Map;
protected var _textureName:String = "";
@@ -33,6 +38,12 @@ package alternativa.editor.prop
private var bound:Mesh;
private var _objects:Vector.;
+
+ private var _collisionEnabled:Boolean = true;
+
+ private var _noCollisionTexture:BitmapData = null;
+ private var _noCollisionMaterial:TextureMaterial = null;
+
public function MeshProp(mainObject:Object3D, objects:Vector., param2:String, param3:String, param4:String, param5:Boolean = true)
{
@@ -121,6 +132,7 @@ package alternativa.editor.prop
{
loc2 = loc1 as Mesh;
loc2.setMaterialToAllFaces(this.collisionMaterial);
+ addChild(loc2);
}
setMaterial(null);
}
@@ -133,6 +145,7 @@ package alternativa.editor.prop
{
loc2 = loc1 as Mesh;
loc2.setMaterialToAllFaces(null);
+ removeChild(loc2);
}
setMaterial(_material);
}
@@ -162,17 +175,27 @@ package alternativa.editor.prop
{
_material.dispose();
}
- _material = new TextureMaterial(bitmapData);
- if(_selected)
- {
- this.disposeSelectTexture();
+ _material = new TextureMaterial(bitmapData);
+
+ this.disposeSelectTexture();
+
+ if(_selected)
+ {
select();
}
else
{
setMaterial(_material);
}
+ if(_noCollisionTexture != null)
+ {
+ _noCollisionMaterial.dispose();
+ _noCollisionMaterial = null;
+ _noCollisionTexture.dispose();
+ _noCollisionTexture = null;
+ }
+ this.setToCollisionDisabledTextureIfNeeded();
if(this._textureName == "DEFAULT")
{
this._textureName = "";
@@ -216,6 +239,7 @@ package alternativa.editor.prop
loc2.bitmaps = this.bitmaps;
loc2._textureName = this._textureName;
loc2.height = height;
+ loc2.collisionEnabled = this._collisionEnabled;
return loc2;
}
@@ -259,6 +283,53 @@ package alternativa.editor.prop
this.bound = null;
}
}
+
+ public function get collisionEnabled() : Boolean
+ {
+ return this._collisionEnabled;
+ }
+ public function set collisionEnabled(enabled:Boolean) : void
+ {
+ if(this._collisionEnabled == enabled)
+ return;
+
+ this._collisionEnabled = enabled;
+
+ this.setToCollisionDisabledTextureIfNeeded();
+ }
+ private function setToCollisionDisabledTextureIfNeeded() : void
+ {
+ if(_collisionEnabled)
+ return;
+ if(_selected) //shouldn't change texture of 'selected'
+ return;
+ if(hidden)
+ return;
+ if(this._textureName == InvisibleTexture.TEXTURE_NAME)
+ return;
+
+ if(_noCollisionTexture == null)
+ {
+ _noCollisionTexture = this.bitmapData.clone();
+
+ _matrix.a = this.bitmapData.width / NO_COLLISION_TEXTURE_Bitmap.width;
+ _matrix.d = this.bitmapData.height / NO_COLLISION_TEXTURE_Bitmap.height;
+
+ _noCollisionTexture.draw(NO_COLLISION_TEXTURE_Bitmap, _matrix);
+
+ //_noCollisionTexture = NO_COLLISION_TEXTURE_Bitmap.clone();
+ _noCollisionMaterial = new TextureMaterial(_noCollisionTexture);
+ }
+
+ setMaterial(_noCollisionMaterial);
+ }
+
+ public override function deselect() : void
+ {
+ super.deselect();
+
+ this.setToCollisionDisabledTextureIfNeeded();
+ }
}
}
diff --git a/src/alternativa/editor/prop/Prop.as b/src/alternativa/editor/prop/Prop.as
index c6d8426..aa1348a 100644
--- a/src/alternativa/editor/prop/Prop.as
+++ b/src/alternativa/editor/prop/Prop.as
@@ -31,7 +31,7 @@ package alternativa.editor.prop
public static const KILL_GEOMETRY:int = 6;
- private static const _matrix:Matrix = new Matrix();
+ protected static const _matrix:Matrix = new Matrix();
private static var redClass:Class = Prop_redClass;
diff --git a/src/alternativa/editor/prop/no_collision_texture.png b/src/alternativa/editor/prop/no_collision_texture.png
new file mode 100644
index 0000000..ab87f17
Binary files /dev/null and b/src/alternativa/editor/prop/no_collision_texture.png differ
diff --git a/src/alternativa/editor/scene/MainScene.as b/src/alternativa/editor/scene/MainScene.as
index f0e9d45..9986bd9 100644
--- a/src/alternativa/editor/scene/MainScene.as
+++ b/src/alternativa/editor/scene/MainScene.as
@@ -44,6 +44,10 @@ package alternativa.editor.scene
import flash.geom.Vector3D;
import alternativa.engine3d.core.Object3DContainer;
import alternativa.editor.prop.CTFFlagBase;
+ import alternativa.editor.PropGeneralPropertiesPanel;
+ import mx.controls.Alert;
+ import mx.containers.HBox;
+ import alternativa.editor.SceneContainer;
public class MainScene extends EditorScene
{
@@ -64,7 +68,7 @@ package alternativa.editor.scene
private var texturePanel:TexturePanel;
- private var propertyPanel:Panel;
+ private const propertyPanel:HBox = new HBox();
private var bonusTypesPanel:BonusRegionPropertiesPanel;
@@ -85,12 +89,15 @@ package alternativa.editor.scene
private var domSpawnPoint:SpawnPoint;
private var controlPointNameField:ControlPointNameField;
+
+ private var propGeneralProperties:PropGeneralPropertiesPanel;
public function MainScene()
{
this.hiddenProps = [];
this.bonusTypesPanel = new BonusRegionPropertiesPanel();
this.killZonePanel = new KillZonePropertiesPanel();
+ this.propGeneralProperties = new PropGeneralPropertiesPanel();
this._selectablePropTypes = new Set();
this.exporters = {};
this.layers = new Layers();
@@ -112,6 +119,7 @@ package alternativa.editor.scene
this.createControlPointNameTextField();
collider = new EllipsoidCollider(30,30,30);
__root = root;
+ this.propertyPanel.percentHeight = this.propertyPanel.percentWidth = 100;
GlobalEventDispatcher.addListener(LayerVisibilityChangeEvent.VISIBILITY_CHANGED,this.onLayerVisibilityChange);
GlobalEventDispatcher.addListener(LayerContentChangeEvent.LAYER_CONTENT_CHANGED,this.onLayerContentChange);
GlobalEventDispatcher.addListener(DominationSpawnLinkStartEvent.DOMINATION_SPAWN_LINK_START,this.onDominationLinkStart);
@@ -178,6 +186,7 @@ package alternativa.editor.scene
public function exportScene(param1:FileType, param2:FileStream) : void
{
+ SceneContainer.instance.cursorScene.clear();
FileExporter(this.exporters[param1]).exportToFileStream(param2);
this._changed = false;
}
@@ -391,7 +400,7 @@ package alternativa.editor.scene
public function setPropertyPanel(param1:Panel) : void
{
- this.propertyPanel = param1;
+ param1.addChild(this.propertyPanel);
this.texturePanel = new TexturePanel();
this.texturePanel.addEventListener(PropListEvent.SELECT,this.onTexturePanelSelect);
}
@@ -553,8 +562,7 @@ package alternativa.editor.scene
}
this.selectedProps.clear();
this.selectedProp = null;
- this.hidePropertyPanelItem(this.bonusTypesPanel);
- this.hidePropertyPanelItem(this.texturePanel);
+ this.hideAllPropertyPanelItems();
}
public function deselectProp(param1:Prop) : void
@@ -569,6 +577,7 @@ package alternativa.editor.scene
if(this.selectedProps.length > 0)
{
+ this.selectedProp = this.selectedProps.peek();
this.showPropertyPanel();
}
@@ -593,7 +602,10 @@ package alternativa.editor.scene
this.selectedProp = loc3;
}
}
- this.showPropertyPanel();
+ if(this.selectedProp != null)
+ {
+ this.showPropertyPanel();
+ }
}
public function selectConflictingProps() : void
@@ -847,7 +859,7 @@ package alternativa.editor.scene
}
}
- public function showPropertyPanel() : void
+ private function showPropertyPanel() : void
{
var loc1:Map = null;
this.hideAllPropertyPanelItems();
@@ -874,15 +886,34 @@ package alternativa.editor.scene
}
this.bonusTypesPanel.setBonusRegion(null);
- for(var item:* in this.selectedProps)
+
+ var item:*;
+ for(item in this.selectedProps)
{
if(!(item is MeshProp))
+ return;
+ }
+
+ this.showTexturePanel();
+
+
+ var collisionEnabled:Boolean = (this.selectedProp as MeshProp).collisionEnabled;
+
+ for(item in this.selectedProps)
+ {
+ if(item is Sprite3DProp)
+ continue;
+ if(collisionEnabled != (item as MeshProp).collisionEnabled)
{
return;
}
}
- this.showTexturePanel();
+ this.texturePanel.percentWidth = 100 - this.propGeneralProperties.percentWidth;
+
+ this.showPropertyPanelItem(this.propGeneralProperties);
+
+ this.propGeneralProperties.init(this.selectedProps, collisionEnabled);
}
private function showTexturePanel() : void
@@ -891,6 +922,8 @@ package alternativa.editor.scene
if(!loc1)
return;
+ this.texturePanel.percentWidth = 100;
+
this.showPropertyPanelItem(this.texturePanel);
if(loc1 != this.currentBitmaps)
{