From 342fb451bd251358068a0dcb10e9dc218b79a176 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Tue, 6 Mar 2012 11:38:39 -0800 Subject: Squashed commit of the following: commit 1cd89d4d06e3a8f2c221628b19cf26a2c69f5d3f Author: Jose Antonio Marquez Date: Tue Mar 6 11:24:25 2012 -0800 Fixing WebGL not available bug commit 84332ab81c1b445195f1d9be8bbeae0725c8e758 Author: Valerio Virgillito Date: Tue Mar 6 10:58:25 2012 -0800 Squashed commit of preload-fix into Master - Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito commit 13f52cf0c74f53a919fa864f86669e8155f82961 Merge: dced508 abc04f3 Author: Valerio Virgillito Date: Fri Mar 2 15:46:11 2012 -0800 Merge pull request #93 from imix23ways/Timeline Timeline: Critical bug fixes commit dced508bb19a7bcd467ff1b86b5df5bbec4be794 Merge: 0aeb400 cc772ef Author: Valerio Virgillito Date: Fri Mar 2 15:45:35 2012 -0800 Merge pull request #92 from mqg734/WebGLFixes Selection Tool Fixes for elements flying off into space when they overlap commit 0aeb400070762cf01d83cf9f9ee25a5595098b7f Merge: ff0a956 aabb48a Author: Valerio Virgillito Date: Fri Mar 2 14:05:21 2012 -0800 Merge pull request #94 from ericguzman/PresetsPanel Presets Panel - Fix single-click activation, and transition cut-off bug. commit cc772ef3333ed419d269a2bda7aea5b0150a7bd9 Author: Nivesh Rajbhandari Date: Fri Mar 2 11:34:58 2012 -0800 Fixing flying off into space bug for translate tool too. Signed-off-by: Nivesh Rajbhandari commit abc04f3d50311ed1c21067344bc7e448686f8c5c Author: Jonathan Duran Date: Fri Mar 2 11:26:25 2012 -0800 Timeline Fix timing function Signed-off-by: Jonathan Duran commit aabb48a1c8d34bc968f4c6b0ffee4e31c1d5d286 Author: Eric Guzman Date: Fri Mar 2 11:22:44 2012 -0800 Presets Panel - Fix single-click activation, and transition cut-off bug. Use double-click as the activation event for transition presets. Also fixed the bug when applying a style preset before the transition preset, which disabled transitions after the first one. commit f3207f39ea9d8c1c34246217a23d3a689671903d Author: Nivesh Rajbhandari Date: Fri Mar 2 11:21:29 2012 -0800 Don't draw transform handles if the stage is the target element. Signed-off-by: Nivesh Rajbhandari commit 5425be91e7125c22955b4459a62412ff574e49a8 Author: Jonathan Duran Date: Fri Mar 2 11:11:48 2012 -0800 Timeline: Fix for animation iteration count Add default webkit css properties to allow animations with integer iteration counts. Signed-off-by: Jonathan Duran commit 1760bac1da9218315ad1bacdcf3a157495a049e8 Author: Nivesh Rajbhandari Date: Fri Mar 2 10:48:41 2012 -0800 Fix for jumping issue when moving items that have any 3d on them. We can't translate 3d moves into 2d space due to perspective, so we must update the matrix3d values instead of the top-left values if items have 3d. Signed-off-by: Nivesh Rajbhandari commit 2c04935f0ccb1cb7c98371fc10b43155f2d956c4 Author: Nivesh Rajbhandari Date: Thu Mar 1 22:20:06 2012 -0800 Fix for elements flying off into space when moving elements that overlap. This was happening because our hit record's element and the browser's element from point did not match. Signed-off-by: Nivesh Rajbhandari commit 50058746779f714ed9b0287f49e56c9f0d35593e Merge: 500426d ff0a956 Author: Nivesh Rajbhandari Date: Thu Mar 1 21:49:44 2012 -0800 Merge branch 'refs/heads/ninja-internal' into WebGLFixes commit 500426dea0ca95a6b45be8ea8d132cfdb4d2c940 Author: Nivesh Rajbhandari Date: Thu Mar 1 10:11:39 2012 -0800 Fixed logic error when resizing with the top-left transform handles. Signed-off-by: Nivesh Rajbhandari commit 7980d9bde2b43aa5a494ddf6f1db5c4959a57b91 Author: Nivesh Rajbhandari Date: Thu Mar 1 10:04:15 2012 -0800 Re-fixing IKNinja-940 - Can't select objects when in side/top view. Signed-off-by: Nivesh Rajbhandari commit f04cc0146d8f7573628678613a99c270116768e4 Author: Nivesh Rajbhandari Date: Wed Feb 29 16:45:40 2012 -0800 Last-used material (instead of FlatMaterial) is applied to shape when turning on use WebGL checkbox in the PI. Signed-off-by: Nivesh Rajbhandari Signed-off-by: Jonathan Duran --- js/models/materials-model.js | 225 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100755 js/models/materials-model.js (limited to 'js/models/materials-model.js') diff --git a/js/models/materials-model.js b/js/models/materials-model.js new file mode 100755 index 00000000..d8fb4016 --- /dev/null +++ b/js/models/materials-model.js @@ -0,0 +1,225 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/////////////////////////////////////////////////////////////////////// +// MaterialsLibrary module -- Contains an array of GLMaterials. +/////////////////////////////////////////////////////////////////////// +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, + AppModel = require("js/models/app-model").AppModel; + +var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser; +var FlatMaterial = require("js/lib/rdge/materials/flat-material").FlatMaterial; +var LinearGradientMaterial = require("js/lib/rdge/materials/linear-gradient-material").LinearGradientMaterial; +var RadialGradientMaterial = require("js/lib/rdge/materials/radial-gradient-material").RadialGradientMaterial; +var BumpMetalMaterial = require("js/lib/rdge/materials/bump-metal-material").BumpMetalMaterial; +var UberMaterial = require("js/lib/rdge/materials/uber-material").UberMaterial; +var RadialBlurMaterial = require("js/lib/rdge/materials/radial-blur-material").RadialBlurMaterial; +var PlasmaMaterial = require("js/lib/rdge/materials/plasma-material").PlasmaMaterial; +var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; +var TunnelMaterial = require("js/lib/rdge/materials/tunnel-material").TunnelMaterial; +var ReliefTunnelMaterial = require("js/lib/rdge/materials/relief-tunnel-material").ReliefTunnelMaterial; +var SquareTunnelMaterial = require("js/lib/rdge/materials/square-tunnel-material").SquareTunnelMaterial; +var FlyMaterial = require("js/lib/rdge/materials/fly-material").FlyMaterial; +var WaterMaterial = require("js/lib/rdge/materials/water-material").WaterMaterial; +var ZInvertMaterial = require("js/lib/rdge/materials/z-invert-material").ZInvertMaterial; +var DeformMaterial = require("js/lib/rdge/materials/deform-material").DeformMaterial; +var StarMaterial = require("js/lib/rdge/materials/star-material").StarMaterial; +var TwistMaterial = require("js/lib/rdge/materials/twist-material").TwistMaterial; +var JuliaMaterial = require("js/lib/rdge/materials/julia-material").JuliaMaterial; +var KeleidoscopeMaterial = require("js/lib/rdge/materials/keleidoscope-material").KeleidoscopeMaterial; +var MandelMaterial = require("js/lib/rdge/materials/mandel-material").MandelMaterial; + + +exports.MaterialsModel = Montage.create(Component, { + + hasTemplate: { + value: false + }, + + deserializedFromTemplate: { + value: function() { + // Load all the materials + this.addMaterial(new FlatMaterial()); + this.addMaterial(new LinearGradientMaterial()); + this.addMaterial(new RadialGradientMaterial()); + this.addMaterial(new BumpMetalMaterial()); + this.addMaterial(new UberMaterial()); + this.addMaterial(new RadialBlurMaterial()); + this.addMaterial(new PlasmaMaterial()); + this.addMaterial(new PulseMaterial()); + this.addMaterial(new TunnelMaterial()); + this.addMaterial(new ReliefTunnelMaterial()); + this.addMaterial(new SquareTunnelMaterial()); + this.addMaterial(new FlyMaterial()); + this.addMaterial(new WaterMaterial()); + this.addMaterial(new ZInvertMaterial()); + this.addMaterial(new DeformMaterial()); + this.addMaterial(new StarMaterial()); + this.addMaterial(new TwistMaterial()); + this.addMaterial(new JuliaMaterial()); + this.addMaterial(new KeleidoscopeMaterial()); + this.addMaterial(new MandelMaterial()); + } + }, + + _materials : { + value: AppModel.materials + }, + + materials : { + get: function() { + return this._materials; + } + }, + + addMaterial: { + value: function (material) { + this._materials.push(material); + } + }, + + addMaterialAt: { + value: function (material, index) { + this._materials.splice(index, 0, material); + } + }, + + removeMaterialAt: { + value: function (index) { + return this._materials.splice(index, 1); + } + }, + + removeMaterial: { + value: function (materialName) { + var index = this.getIndexOfMaterial(materialName); + if(index !== -1) { + return this.removeMaterialAt(index); + } + } + }, + + getMaterialAt: { + value: function (index) { + return this._materials[index]; + } + }, + + getMaterial: { + value: function (materialName) { + var index = this.getIndexOfMaterial(materialName); + if(index !== -1) { + return this._materials[index]; + } + } + }, + + getIndexOfMaterial: { + value: function (materialName) { + var len = this._materials.length; + for(var i=0; i