Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make step size relative again

  • Loading branch information...
commit 8d4496c503deee36062bbebffbf997feeae1245a 1 parent 0865f8d
tomre authored
Showing with 40 additions and 32 deletions.
  1. +20 −16 out/js/teztura.js
  2. +2 −2 src/app.coffee
  3. +18 −14 src/tools.coffee
View
36 out/js/teztura.js
@@ -299,8 +299,8 @@ $(document).ready(function() {
loadGradient('g1', 'img/gradient-1.png');
loadMatcaps([
{
- name: 'clay1',
- url: 'img/matcaps/clay_1.0.png'
+ name: 'clay2',
+ url: 'img/matcaps/clay_2.jpg'
}
]);
Renderers = [GammaRenderer, GradientRenderer, NormalRenderer, MatcapRenderer];
@@ -761,11 +761,10 @@ RoundBrush = (function() {
};
properties = [
{
- id: 'stepSize',
- name: "Step size",
- defaultValue: 3,
- range: [1, 10],
- type: 'int'
+ id: 'step',
+ name: "Step %",
+ defaultValue: 10,
+ range: [0, 100]
}, {
id: 'hardness',
name: "Hardness",
@@ -794,9 +793,12 @@ RoundBrush = (function() {
createTool = function(env) {
var func, hardness, hardnessPlus1, sb, size;
sb = new StepBrush();
- sb.stepSize = self.get('stepSize');
- sb.tiling = env.get('tiling');
size = self.get('size');
+ sb.stepSize = Math.round(self.get('step') * size / 100.0);
+ if (sb.stepSize < 1) {
+ sb.stepSize = 1;
+ }
+ sb.tiling = env.get('tiling');
hardness = Math.pow(self.get('hardness'), 2.0) * 8.0;
hardnessPlus1 = hardness + 1.0;
func = genBrushFunc({
@@ -829,11 +831,10 @@ FlattenBrush = (function() {
};
properties = [
{
- id: 'stepSize',
- name: "Step size",
- defaultValue: 3,
- range: [1, 10],
- type: 'int'
+ id: 'step',
+ name: "Step %",
+ defaultValue: 10,
+ range: [0, 100]
}, {
id: 'hardness',
name: "Hardness",
@@ -857,9 +858,12 @@ FlattenBrush = (function() {
createTool = function(env) {
var func, hardness, hardnessPlus1, sb, size;
sb = new StepBrush();
- sb.stepSize = self.get('stepSize');
- sb.tiling = env.get('tiling');
size = self.get('size');
+ sb.stepSize = Math.round(self.get('step') * size / 100.0);
+ if (sb.stepSize < 1) {
+ sb.stepSize = 1;
+ }
+ sb.tiling = env.get('tiling');
hardness = Math.pow(self.get('hardness'), 2.0) * 8.0;
hardnessPlus1 = hardness + 1.0;
func = genBrushFunc({
View
4 src/app.coffee
@@ -229,8 +229,8 @@ $(document).ready ()->
loadGradient('g1', 'img/gradient-1.png')
loadMatcaps([
- # {name: 'clay2', url: 'img/matcaps/clay_2.jpg'}
- {name: 'clay1', url: 'img/matcaps/clay_1.0.png'}
+ {name: 'clay2', url: 'img/matcaps/clay_2.jpg'}
+ # {name: 'clay1', url: 'img/matcaps/clay_1.0.png'}
])
#loadGradient('g2', 'img/gradient-2.png')
View
32 src/tools.coffee
@@ -72,11 +72,10 @@ RoundBrush = (()->
name: 'Round'
properties = [
{
- id: 'stepSize'
- name: "Step size"
- defaultValue: 3
- range: [1, 10]
- type: 'int'
+ id: 'step'
+ name: "Step %"
+ defaultValue: 10
+ range: [0, 100]
},
{
id: 'hardness'
@@ -110,9 +109,12 @@ RoundBrush = (()->
createTool = (env)->
sb = new StepBrush()
- sb.stepSize = self.get('stepSize')
- sb.tiling = env.get('tiling')
+
size = self.get('size')
+ sb.stepSize = Math.round(self.get('step') * size / 100.0)
+ if sb.stepSize < 1
+ sb.stepSize = 1
+ sb.tiling = env.get('tiling')
hardness = Math.pow(self.get('hardness'), 2.0) * 8.0;
hardnessPlus1 = hardness + 1.0
@@ -150,11 +152,10 @@ FlattenBrush = (()->
name: 'Flatten'
properties = [
{
- id: 'stepSize'
- name: "Step size"
- defaultValue: 3
- range: [1, 10]
- type: 'int'
+ id: 'step'
+ name: "Step %"
+ defaultValue: 10
+ range: [0, 100]
},
{
id: 'hardness'
@@ -182,10 +183,13 @@ FlattenBrush = (()->
createTool = (env)->
sb = new StepBrush()
- sb.stepSize = self.get('stepSize')
- sb.tiling = env.get('tiling')
size = self.get('size')
+ sb.stepSize = Math.round(self.get('step') * size / 100.0)
+ if sb.stepSize < 1
+ sb.stepSize = 1
+ sb.tiling = env.get('tiling')
+
hardness = Math.pow(self.get('hardness'), 2.0) * 8.0;
hardnessPlus1 = hardness + 1.0
func = genBrushFunc {
Please sign in to comment.
Something went wrong with that request. Please try again.