@@ -148,6 +148,9 @@ def notify(self, args):
148
148
resolutionYField = inputs .addIntegerSpinnerCommandInput ('resolutionYField' , 'ResolutionY' , 2 , 1000 , 1 , 10 )
149
149
resolutionYField .tooltip = "Sets the y-resolution of the applied noise function. \n The higher the resolution, the more features are visible."
150
150
151
+ resolutionZField = inputs .addIntegerSpinnerCommandInput ('resolutionZField' , 'ResolutionZ' , 2 , 1000 , 1 , 10 )
152
+ resolutionZField .tooltip = "Sets the z-resolution of the applied noise function. \n The higher the resolution, the more features are visible."
153
+
151
154
# Plane input for 2D noise
152
155
#planeInput = inputs.addSelectionInput('planeInput', 'Plane', 'Select Plane to apply noise to.')
153
156
#planeInput.addSelectionFilter('ConstructionPlanes')
@@ -249,6 +252,7 @@ def notify(self, args):
249
252
advancedGroup = inputs .itemById ('advancedGroup' )
250
253
resolutionField = inputs .itemById ('resolutionField' )
251
254
resolutionYField = inputs .itemById ('resolutionYField' )
255
+ resolutionZField = inputs .itemById ('resolutionZField' )
252
256
frequencyField = inputs .itemById ('frequencyField' )
253
257
imageField = inputs .itemById ('imageField' )
254
258
fileDialogButton = inputs .itemById ('fileDialogButton' )
@@ -271,6 +275,7 @@ def notify(self, args):
271
275
smoothBox .isVisible = True
272
276
resolutionField .isVisible = True
273
277
resolutionYField .isVisible = True
278
+ resolutionZField .isVisible = True
274
279
#frequencyField.isVisible = True
275
280
algDescriptionBox .text = "Generates noise based on a continous function. The dimension of the function can be specified as well as the resolution."
276
281
elif changedInput .selectedItem .name == 'Perlin Noise' :
@@ -370,7 +375,7 @@ def notify(self, args):
370
375
product = app .activeProduct #the fusion tab that is active
371
376
rootComp = product .rootComponent # the root component of the active product
372
377
meshBodies = rootComp .meshBodies
373
- algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , frequency , inverse , stepActive , stepPadding , planeString = getInputs (inputs )
378
+ algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , resolutionZ , frequency , inverse , stepActive , stepPadding , planeString = getInputs (inputs )
374
379
375
380
currentPreview = []
376
381
currentPreviewMesh = []
@@ -382,13 +387,13 @@ def notify(self, args):
382
387
mesh = selection .mesh
383
388
body = meshHelper .fusionPolygonMeshToBody (mesh )
384
389
385
- computeNoise (progressDialog , algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , frequency , inverse , stepActive , stepPadding , planeString , body )
390
+ computeNoise (progressDialog , algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , resolutionZ , frequency , inverse , stepActive , stepPadding , planeString , body )
386
391
387
392
selection .isLightBulbOn = False
388
393
currentPreview .append (body )
389
394
currentPreviewMesh .append (mesh )
390
395
showMeshPreview (body ,mesh )
391
- # app.activeViewport.refresh()
396
+ app .activeViewport .refresh ()
392
397
except ValueError as err :
393
398
if 'CanceledProgress' in err .args :
394
399
currentPreview = []
@@ -421,7 +426,7 @@ def notify(self, args):
421
426
eventArgs = adsk .core .CommandEventArgs .cast (args )
422
427
# Get the values from the command inputs.
423
428
inputs = eventArgs .command .commandInputs
424
- algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , frequency , inverse , stepActive , stepPadding , planeString = getInputs (inputs )
429
+ algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , resolutionZ , frequency , inverse , stepActive , stepPadding , planeString = getInputs (inputs )
425
430
426
431
selectionList = []
427
432
for i in range (inputs .itemById ('body_input' ).selectionCount ):
@@ -433,7 +438,7 @@ def notify(self, args):
433
438
if len (currentPreview ) > 0 :
434
439
body = currentPreview [i ]
435
440
else :
436
- computeNoise (progressDialog , algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , frequency , inverse , stepActive , stepPadding , planeString , body )
441
+ computeNoise (progressDialog , algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , resolutionZ , frequency , inverse , stepActive , stepPadding , planeString , body )
437
442
438
443
# Hide the original meshBody, add and name the new one
439
444
selection .isLightBulbOn = False
@@ -459,6 +464,7 @@ def getInputs(inputs):
459
464
smooth = inputs .itemById ('smoothBox' ).value
460
465
resolution = inputs .itemById ('resolutionField' ).value
461
466
resolutionY = inputs .itemById ('resolutionYField' ).value
467
+ resolutionZ = inputs .itemById ('resolutionZField' ).value
462
468
frequency = inputs .itemById ('frequencyField' ).value
463
469
inverse = inputs .itemById ('inverseBox' ).value
464
470
stepActive = inputs .itemById ('stepGroup' ).isEnabledCheckBoxChecked
@@ -473,9 +479,9 @@ def getInputs(inputs):
473
479
planeString = 'xZ'
474
480
elif planeInput .selectedItem .name == "yZ" :
475
481
planeString = 'yZ'
476
- return algorithm ,seed ,degree ,dimension3 ,dimension2 ,signed ,smooth ,resolution ,resolutionY ,frequency ,inverse ,stepActive ,stepPadding ,planeString
482
+ return algorithm ,seed ,degree ,dimension3 ,dimension2 ,signed ,smooth ,resolution ,resolutionY ,resolutionZ , frequency ,inverse ,stepActive ,stepPadding ,planeString
477
483
478
- def computeNoise (progressDialog , algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , frequency , inverse , stepActive , stepPadding , planeString , body ):
484
+ def computeNoise (progressDialog , algorithm , seed , degree , dimension3 , dimension2 , signed , smooth , resolution , resolutionY , resolutionZ , frequency , inverse , stepActive , stepPadding , planeString , body ):
479
485
progressDialog .show ('Computing Noise...' , 'Percentage: %p% - %v/%m steps completed' ,0 ,len (body .vertices ),2 )
480
486
if algorithm == 'Adaptive Noise' :
481
487
progressDialog .show ('Computing Noise...' , 'Percentage: %p% - %v/%m steps completed' ,0 ,len (body .facets ),2 )
@@ -488,7 +494,7 @@ def computeNoise(progressDialog, algorithm, seed, degree, dimension3, dimension2
488
494
elif dimension3 == '2D' :
489
495
valueNoise2D (body ,resolution ,resolutionY ,degree ,frequency ,signed ,smooth ,seed , progressDialog )
490
496
elif dimension3 == '3D' :
491
- valueNoise3D (body ,resolution ,degree ,frequency ,signed ,smooth ,seed , progressDialog )
497
+ valueNoise3D (body ,resolution ,resolutionY , resolutionZ , degree ,frequency ,signed ,smooth ,seed , progressDialog )
492
498
elif algorithm == 'Perlin Noise' :
493
499
if dimension2 == '2D' :
494
500
perlinNoise2D (body ,resolution ,degree ,frequency ,signed ,smooth ,seed ,progressDialog )
0 commit comments