Как найти ключевые точки по рельефу?
Как данные о расстоянии между вершинами граней вывести в файл?
Простой пример:
Создаем объект
точка-point в любом месте и выделяем его.
В меню Animation > Constraints выбираем пункт Attachment Constraint и выбираем модель поверхности лица.
В свитке Attachment Parameters включаем кнопку Set Position.
Нажимаем и удерживаем левую кнопку мыши над поверхностью лица, чтобы установить точное место для точки-point.
В свитке Attachment Parameters выключаем кнопку Set Position.
Создаем еще точки и выравниваем их по рельефу.
Запускаем скрипт. Появляется окно Graph.
Выделяем 2 объекта точка-point и нажимаем кнопку Create Tape.
Выеляем другие 2 объекта точка-point и нажимаем кнопку Create Tape.
Выделяем все объекты точка-point и/или все объекты рулетка-Tape и нажимаем кнопку Get Data.
Выделяем весь текст и копируем в нужный текстовый файл.
Код:
rollout igorznag_graph "Graph"
(
button create_tape "Create Tape" pos:[5,5];
button get_data "Get Data" pos:[100,5];
edittext graph_data fieldWidth:280 pos:[5,30] height:250
on create_tape pressed do
(
if selection.count==2 then
(
if classof selection[1]==Point and classof selection[2]==Point then
(
t=tape pos:selection[1].pos target:(targetObject pos:selection[2].pos)
t.parent=selection[1]; t.target.parent=selection[2]
)--if classof selection[1]==Point and classof selection[2]==Point then
)--if selection.count==2 then
)--on create_tape pressed do
on get_data pressed do
(
objs_tape=#();objs_point=#()
for obj in selection do
(if classof obj==tape then append objs_tape obj
if classof obj==point then append objs_point obj)
str="Distance by tape\n";
for obj in objs_tape do
(
str+=((distance obj obj.target) as string)+". "+obj.name+". "
str+="P1="+obj.parent.name+". P2="+obj.target.parent.name+".\n"
)--for obj in objs_tape do
str+="\n";str+="Distance by point\n";
for obj in objs_point do
(
str+="P1="+obj.name+"\n"
for o in obj.children do
(
if classof o==tape and o.target.parent!=undefined then
(
str+=((distance o o.target) as string)+". P2="+o.target.parent.name
str+=". Tape="+o.name+"\n"
)--if classof o==tape and o.target.parent!=undefined then
if o.isTarget then
(
t=o.lookAt;
if classof t==tape and t.parent!=undefined then
(
str+=((distance t t.target) as string)+". P2="+t.parent.name
str+=". Tape="+t.name+"\n"
)--if classof t==tape then
)--if o.isTarget then then
)--for o in obj.children do
)--for obj in objs_point do
graph_data.text=str
)--on get_data pressed do
); createdialog igorznag_graph 300 300
Чтобы запустить скрипт нужно:
1. Создаем текстовый файл (NotePad) и копируем код (текст) скрипта.
2. Сохраняем текстовый файл с названием "test.ms"
3. В главное меню MaxScript выбираем пункт Run Script. Выбираем файл "test.ms"