Skip to content

Commit

Permalink
Merge pull request #550 from stuikomma/release/v0.9.2
Browse files Browse the repository at this point in the history
Release/v0.9.2
  • Loading branch information
ad-si committed May 29, 2015
2 parents 5c96ec5 + f97427a commit 2579818
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Brickify",
"version": "0.9.1",
"version": "0.9.2",
"description": "Extend your LEGO® with 3D-printed parts!",
"keywords": [
"fabrication",
Expand Down
7 changes: 4 additions & 3 deletions src/client/landingpage.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require './polyfills'
$ = require 'jquery'
window.jQuery = window.$ = $
bootstrap = require 'bootstrap'
piwikTracking = require './piwikTracking'

# Init quickconvert after basic page functionality has been initialized
globalConfig = require '../common/globals.yaml'
Expand Down Expand Up @@ -65,12 +66,12 @@ b1 = bundle1.init().then ->
callback = (event) ->
files = event.target.files ? event.dataTransfer.files
if files.length
_paq.push ['trackEvent', 'Landingpage', 'LoadModel', files[0].name]
piwikTracking.trackEvent 'Landingpage', 'LoadModel', files[0].name
fileLoader.onLoadFile files, $('#loadButton')[0], shadow: false
.then loadFromHash
else
hash = event.dataTransfer.getData 'text/plain'
_paq.push ['trackEvent', 'Landingpage', 'LoadModelFromImage', hash]
piwikTracking.trackEvent 'Landingpage', 'LoadModelFromImage', hash
modelCache.exists hash
.then -> loadFromHash hash
.catch -> bootbox.alert(
Expand All @@ -97,7 +98,7 @@ b1 = bundle1.init().then ->

# set not available message
$('#downloadButton').click ->
_paq.push ['trackEvent', 'Landingpage', 'ButtonClick', 'Download']
piwikTracking.trackEvent 'Landingpage', 'ButtonClick', 'Download'
bootbox.alert({
title: 'Not available'
message: 'This feature is not available yet - please check back later.<br>' +
Expand Down
10 changes: 7 additions & 3 deletions src/client/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ log = require 'loglevel'
Bundle = require './bundle'
globalConfig = require '../common/globals.yaml'

piwikTracking = require './piwikTracking'

if process.env.NODE_ENV is 'development'
log.enableAll()

else
log.setLevel 'warn'

commandFunctions = {
initialModel: (value) ->
_paq.push ['trackEvent', 'Editor', 'Start', 'WithInitialModel']
piwikTracking.trackEvent(
'trackEvent', 'Editor', 'StartWithInitialModel', value
)
# load selected model
log.debug 'loading initial model'
p = /^[0-9a-z]{32}/
Expand All @@ -42,7 +46,7 @@ postInitCallback = ->
prom = prom.then runCmd key, value

if commands.length == 0
_paq.push ['trackEvent', 'Editor', 'Start', 'WithoutInitialModel']
piwikTracking.trackEvent 'Editor', 'Start', 'StartWithoutInitialModel'

#clear url hash after executing commands
window.location.hash = ''
Expand Down
12 changes: 12 additions & 0 deletions src/client/piwikTracking.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports.trackEvent = (category, action,
name = null, numericValue = null) =>
if _paq?
_paq.push(
['trackEvent', category, action, name, numericValue]
)

module.exports.setCustomSessionVariable = (slot, name, content) =>
if _paq?
_paq.push(
['setCustomVariable', slot, name, content, 'visit']
)
4 changes: 3 additions & 1 deletion src/client/ui/workflowUi/EditBrushUi.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
piwikTracking = require '../../piwikTracking'

###
# @class EditBrushUi
###
Expand Down Expand Up @@ -48,7 +50,7 @@ class EditBrushUi
# piwik select event
big = ''
big = 'Big' if @_bigBrushSelected
_paq.push ['trackEvent', 'Editor', 'BrushSelect', brush.containerId + big]
piwikTracking.trackEvent 'Editor', 'BrushSelect', brush.containerId + big

#select new brush
@_selectedBrush = brush
Expand Down
5 changes: 4 additions & 1 deletion src/client/ui/workflowUi/ExportUi.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DownloadProvider = require './downloadProvider'
piwikTracking = require '../../piwikTracking'

class ExportUi
constructor: (@workflowUi) ->
Expand All @@ -17,7 +18,7 @@ class ExportUi

#show modal when clicking on download button
@downloadButton.click =>
_paq.push ['trackEvent', 'Editor', 'ExportAction', 'DownloadButtonClick']
piwikTracking.trackEvent 'Editor', 'ExportAction', 'DownloadButtonClick'
@downloadModal.modal 'show'

_initDownloadModalContent: =>
Expand All @@ -40,10 +41,12 @@ class ExportUi

_updateStudRadius: =>
studSelection = parseInt @studSizeSelect.val()
@studRadiusSelection = @studSizeSelect.val()
@studRadius = @studSize.radius + studSelection * @exportStepSize

_updateHoleRadius: =>
holeSelection = parseInt @holeSizeSelect.val()
@holeRadiusSelection = @holeSizeSelect.val()
@holeRadius = @holeSize.radius + holeSelection * @exportStepSize


Expand Down
3 changes: 2 additions & 1 deletion src/client/ui/workflowUi/LoadUi.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fileDropper = require '../../modelLoading/fileDropper'
fileLoader = require '../../modelLoading/fileLoader'
piwikTracking = require '../../piwikTracking'

class LoadUi
constructor: (@workflowUi) ->
Expand All @@ -21,7 +22,7 @@ class LoadUi
files = event.target.files ? event.dataTransfer.files
@_checkReplaceModel().then (loadConfirmed) =>
return unless loadConfirmed
_paq.push ['trackEvent', 'Editor', 'LoadModel', files[0].name]
piwikTracking.trackEvent 'Editor', 'LoadModel', files[0].name
spinnerOptions =
length: 5
radius: 3
Expand Down
5 changes: 3 additions & 2 deletions src/client/ui/workflowUi/PreviewUi.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PreviewAssemblyUi = require './PreviewAssemblyUi'
piwikTracking = require '../../piwikTracking'

class PreviewUi
constructor: (@workflowUi) ->
Expand Down Expand Up @@ -47,7 +48,7 @@ class PreviewUi
@editController.disableInteraction()
@nodeVisualizer.setDisplayMode @sceneManager.selectedNode, 'stability'
else
_paq.push ['trackEvent', 'Editor', 'PreviewAction', 'StabilityView']
piwikTracking.trackEvent 'Editor', 'PreviewAction', 'StabilityView'
@editController.enableInteraction()

_initAssemblyView: =>
Expand All @@ -68,7 +69,7 @@ class PreviewUi
@_quitStabilityView()

if @assemblyViewEnabled
_paq.push ['trackEvent', 'Editor', 'PreviewAction', 'AssemblyView']
piwikTracking.trackEvent 'Editor', 'PreviewAction', 'AssemblyView'
@workflowUi.enableOnly @
else
@workflowUi.enableAll()
Expand Down
13 changes: 6 additions & 7 deletions src/client/ui/workflowUi/downloadProvider.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ $ = require 'jquery'
modelCache = require '../../modelLoading/modelCache'
saveAs = require 'filesaver.js'
JSZip = require 'jszip'
piwikTracking = require '../../piwikTracking'

module.exports = class DownloadProvider
constructor: (@bundle) ->
Expand All @@ -23,14 +24,12 @@ module.exports = class DownloadProvider
}

if (fileType == 'stl')
_paq.push ['trackEvent', 'Editor', 'ExportAction', 'DownloadStlClick']
_paq.push(
['trackEvent', 'Editor', 'ExportAction', 'StudRadius',
downloadOptions.studRadius]
piwikTracking.trackEvent 'EditorExport', 'DownloadStlClick'
piwikTracking.trackEvent(
'EditorExport', 'StudRadius', @exportUi.studRadiusSelection
)
_paq.push(
['trackEvent', 'Editor', 'ExportAction', 'HoleRadius',
downloadOptions.holeRadius]
piwikTracking.trackEvent(
'EditorExport', 'HoleRadius', @exportUi.holeRadiusSelection
)

promisesArray = @bundle.pluginHooks.getDownload selectedNode, downloadOptions
Expand Down
7 changes: 5 additions & 2 deletions src/client/ui/workflowUi/workflowUi.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
perfectScrollbar = require 'perfect-scrollbar'
piwikTracking = require '../../piwikTracking'

LoadUi = require './LoadUi'
EditUi = require './EditUi'
Expand Down Expand Up @@ -57,10 +58,12 @@ class WorkflowUi
})

$('#downloadPdfButton').click ->
_paq.push ['trackEvent', 'Editor', 'ExportAction', 'DownloadPdfClick']
piwikTracking.trackEvent 'Editor', 'ExportAction', 'DownloadPdfClick'
alertCallback()
$('#shareButton').click ->
_paq.push ['trackEvent', 'Editor', 'ExportAction', 'ShareButtonClick']
piwikTracking.trackEvent(
'trackEvent', 'Editor', 'ExportAction', 'ShareButtonClick'
)
alertCallback()

_initScrollbar: ->
Expand Down
16 changes: 6 additions & 10 deletions src/plugins/editController/BrushHandler.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
log = require 'loglevel'

piwikTracking = require '../../client/piwikTracking'

class BrushHandler
constructor: ( @bundle, @nodeVisualizer, @editController ) ->
Expand Down Expand Up @@ -68,10 +68,7 @@ class BrushHandler

brush = 'LegoBrush'
brush += 'Big' if @bigBrushSelected
_paq.push(
['trackEvent', 'Editor', 'BrushAction', brush,
touchedVoxels.length]
)
piwikTracking.trackEvent 'Editor', 'BrushAction', brush, touchedVoxels.length

return unless touchedVoxels.length > 0
log.debug "Will re-layout #{touchedVoxels.length} voxel"
Expand All @@ -98,7 +95,7 @@ class BrushHandler
@nodeVisualizer._getCachedData selectedNode
.then (cachedData) =>
return unless cachedData.brickVisualization.makeAllVoxelsLego selectedNode
_paq.push(['trackEvent', 'Editor', 'BrushAction', 'MakeEverythingLego'])
piwikTracking.trackEvent 'Editor', 'BrushAction', 'MakeEverythingLego'
@editController.rerunLegoPipeline selectedNode
brickVis = cachedData.brickVisualization
brickVis.updateModifiedVoxels()
Expand Down Expand Up @@ -127,9 +124,8 @@ class BrushHandler

brush = 'PrintBrush'
brush += 'Big' if @bigBrushSelected
_paq.push(
['trackEvent', 'Editor', 'BrushAction', brush,
touchedVoxels.length]
piwikTracking.trackEvent(
'Editor', 'BrushAction', brush, touchedVoxels.length
)

return unless touchedVoxels.length > 0
Expand Down Expand Up @@ -158,7 +154,7 @@ class BrushHandler
.then (cachedData) =>
return unless cachedData.
brickVisualization.makeAllVoxels3dPrinted selectedNode
_paq.push(['trackEvent', 'Editor', 'BrushAction', 'MakeEverythingPrint'])
piwikTracking.trackEvent 'Editor', 'BrushAction', 'MakeEverythingPrint'
cachedData.brickVisualization.updateModifiedVoxels()
@editController.everythingPrint selectedNode

Expand Down
24 changes: 23 additions & 1 deletion src/plugins/fidelityControl/fidelityControl.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
###

$ = require 'jquery'
piwikTracking = require '../../client/piwikTracking'

minimalAcceptableFps = 20
upgradeThresholdFps = 40
accumulationTime = 200
timesBelowThreshold = 10
fpsDisplayUpdateTime = 1000
maxNoPipelineDecisions = 3

piwikStatInterval = 20

###
# @class FidelityControl
Expand All @@ -39,6 +40,8 @@ class FidelityControl
@accumulatedFrames = 0
@accumulatedTime = 0

@currentPiwikStat = 0

@timesBelowMinimumFps = 0

@showFps = process.env.NODE_ENV is 'development'
Expand All @@ -49,6 +52,13 @@ class FidelityControl
usePipeline = @bundle.globalConfig.rendering.usePipeline
fragDepth = @bundle.renderer.threeRenderer.extensions.get 'EXT_frag_depth'
stencilBuffer = @bundle.renderer.threeRenderer.hasStencilBuffer

capabilites = ''
capabilites += 'ExtFragDepth' if fragDepth?
capabilites += ' stencilBuffer' if stencilBuffer

piwikTracking.setCustomSessionVariable 0, 'GpuCapabilities', capabilites

@pipelineAvailable = usePipeline and fragDepth? and stencilBuffer
@noPipelineDecisions = 0

Expand All @@ -70,6 +80,18 @@ class FidelityControl
@_adjustFidelity fps
@_showFps timestamp, fps

@currentPiwikStat++
if @currentPiwikStat > piwikStatInterval
@_sendFpsStats(fps)
@currentPiwikStat = 0

_sendFpsStats: (fps) =>
piwikTracking.trackEvent(
'FidelityControl', 'FpsAverage',
FidelityControl.fidelityLevels[@currentFidelityLevel],
fps
)

_adjustFidelity: (fps) =>
return unless @autoAdjust

Expand Down

0 comments on commit 2579818

Please sign in to comment.