-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path#PankovScripts-CopyPaste.mcr
More file actions
121 lines (105 loc) · 6.22 KB
/
Copy path#PankovScripts-CopyPaste.mcr
File metadata and controls
121 lines (105 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
macroScript Pankov_Copy
category:"#PankovScripts"
buttontext:"Copy"
tooltip:"COPY-paste selected to temporary file"
icon:#("pankov_CopyPaste", 1)
(
local FileBuffer = getdir #AutoBack + "\\CopyPaste.max"
on isenabled return (
selection.count > 0
)
on execute do (
if doesFileExist FileBuffer then deletefile FileBuffer
saveNodes $ FileBuffer
)
)
macroScript Pankov_Paste
category:"#PankovScripts"
buttontext:"Paste"
tooltip:"copy-PASTE from temporary file. With Ctrl to clear"
icon:#("pankov_CopyPaste", 2)
(
local FileBuffer = getdir #AutoBack + "\\CopyPaste.max"
on isenabled return (
doesFileExist FileBuffer
)
on execute do
(
if keyboard.controlPressed == false then (
mergemaxfile FileBuffer #select #mergeDups --#useSceneMtlDups
) else (
deletefile FileBuffer
)
)
)
macroScript Pankov_Copy_Modif
category:"#PankovScripts"
buttontext:"CopyMod"
tooltip:"COPY-paste Modifier"
icon:#("pankov_CopyPaste", 1)
(
global Pankov_Copy_Modif_buffer
on isenabled return (
superclassof (modpanel.getCurrentObject()) == modifier
)
on execute do (
local modif = modpanel.getCurrentObject()
if superclassof modif == modifier then Pankov_Copy_Modif_buffer = modif
print (format "Copy modif '%' is " modif.name)
)
)
macroScript Pankov_Paste_Modif
category:"#PankovScripts"
buttontext:"PasteMod"
tooltip:"copy-PASTE Modifier"
icon:#("pankov_CopyPaste", 2)
(
global Pankov_Copy_Modif_buffer
on isenabled return (
selection.count > 0 and Pankov_Copy_Modif_buffer != undefined
)
on execute do (
-- Стандартная функция. добвляет сверху выделенного модификатора
if Pankov_Copy_Modif_buffer != undefined then try (modpanel.addModToSelection Pankov_Copy_Modif_buffer) catch (print "Can't paste")
-- Своя функция. добавляет снизу выделенного модификатора
/*
local sel = selection as array
local i = 0
local modif = modpanel.getCurrentObject()
for obj in selection where finditem #(GeometryClass, shape) (superclassof obj) > 0 do (
if superclassof modif == modifier then i = finditem obj.modifiers modif
addmodifier obj Pankov_Copy_Modif_buffer before:i
)
deselect $*
select sel
max modify mode
*/
completeRedraw()
)
)
macroScript Pankov_Select_Mod_Instances
category:"#PankovScripts"
buttontext:"SelModInstances"
tooltip:"Select Modifier Instances"
(
on isenabled do (
local modif = modPanel.getCurrentObject()
(superclassof modif == modifier) and (modPanel.validModifier modif) and (refs.dependentnodes modif).count > 1
)
on execute do (
local modif = modPanel.getCurrentObject()
objs = refs.dependentnodes modif
-- определить видмые в данный момент объекты
actionMan.executeAction 0 "40021" -- Selection: Select All
visible_sel = selection as array
clearselection()
objs = for obj in visible_sel where finditem objs obj collect obj
select objs
-- Раскрываем группы, если объекты оказались в группе
if selection.count > objs.count do (
for obj in selection where isgrouphead obj do setgroupopen obj true
clearselection()
select objs
)
)
)