2013-09-14 4 views
0

Что не так в следующих выражениях, которые я пытаюсь установить для определенного атрибута в Maya. Все это просто разные подходы.Ошибка синтаксиса выражения майя

Выражение 1:

directionalLightShape1.intensity = sqrt(noise(time)); 

Ошибка:

expression -s "directionalLightShape1.intensity = sqrt(noise(time));" -o directionalLightShape1 -ae 1 -uc all ; 
// Error: line 0: Invalid argument(s) for sqrt. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 0: Invalid argument(s) for sqrt. // 
// Error: An execution error occured in the expression expression1. // 

Выражение 2:

float $n = noise(time); 
directionalLightShape1.intensity = sqrt($n); 

Ошибка:

expression -e -s "float $n = noise(time);\ndirectionalLightShape1.intensity = sqrt($n);" -o directionalLightShape1 -ae 1 -uc all expression1; 
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: An execution error occured in the expression expression1. // 

Выражение 3:

float $n = sqrt(`noise time`); 
directionalLightShape1.intensity = $n; 

Ошибка:

expression -e -s "float $n = sqrt(`noise time`);\ndirectionalLightShape1.intensity = $n;" -o directionalLightShape1 -ae 1 -uc all expression1; 
// Error: line 0: Invalid call to "noise". Check number and types of arguments expected by the procedure. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 0: Invalid call to "noise". Check number and types of arguments expected by the procedure. // 
// Error: An execution error occured in the expression expression1. // 

Выражение 4:

float $n = noise(time); 
directionalLightShape1.intensity = `sqrt $n`; 

Ошибка:

expression -e -s "float $n = noise(time);\ndirectionalLightShape1.intensity = `sqrt $n`;" -o directionalLightShape1 -ae 1 -uc all expression1; 
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: line 0: An execution error occured in the expression expression1. // 
// Result: expression1 // 
// Error: line 1: Invalid argument(s) for sqrt. // 
// Error: An execution error occured in the expression expression1. // 

ответ

1

Возможно, вы захотите использовать (noise(time) + 1)/2, если вы видите артефакты с использованием abs.

В зависимости от приложения может быть проблемой усечение диапазона.

+0

не должно быть '/ 2'? –

0

Проблема со всеми указанными выражениями, что noise возвращается отрицательное значение. Который при подаче на sqrt, естественно, должен был пропустить ошибку, которая была не совсем очевидна вначале.

Замена noise(time) на abs(noise(time)) решена.

Смежные вопросы