-
Notifications
You must be signed in to change notification settings - Fork 1
/
ImagePlane.ms
721 lines (595 loc) · 24 KB
/
ImagePlane.ms
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
macroScript ImagePlane
category:"ilya_s Scripts"
tooltip:"Image Plane Creator"
buttontext:"ImgPlane"
(
global ImagePlane_RO
local h_value, w_value
fn convertMaxUtoDisplayU val =
(
(val/units.decodeValue "1")
)
fn convertDisplayUToMaxU val =
(
(val * (units.decodeValue "1"))
)
fn collectImgFiles =
(
theDialog = dotNetObject "System.Windows.Forms.OpenFileDialog" --create a OpenFileDialog
theDialog.title = "Select One Or More Files" --set the title
theDialog.Multiselect = true --allow multiple files to be selected
--theDialog.Filter = "HTML Files (*.html)|*.html|All Files (*.*)|*.*" --specify the filter
theDialog.Filter = "All Files (*.*)|*.*|Jpg(*.jpg,*.jpeg)|*.jpg;*.jpeg|PNG(*.png)|*.png|Tiff(*.tiff)|*.tiff|Tif(*.tif)|*.tif |Tga(*.tga)|*.tga"
theDialog.FilterIndex = 1 --set the filter drop-down list to All Files
result = theDialog.showDialog() --display the dialog, get result into variable
result.ToString() --when closed, convert the result to string
result.Equals result.OK --returns TRUE if OK was pressed, FALSE otherwise
result.Equals result.Cancel --returns TRUE if Cancel was pressed, FALSE otherwise
return theDialog.fileNames --the selected filenames will be returned as an array
)
fn createImagePlane =
(
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
for o in f do
(
local map = openbitmap o
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * planeSize)/map.height
local genplane = Plane realWorldMapSize:off length:planeSize width:ratio transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,planeSize/2]) isSelected:off
genplane.lengthsegs = h_value
genplane.widthsegs = w_value
genplane.name = "ImagePlane__" + filenameFromPath o
genplane.pivot = [genplane.pivot.x,genplane.pivot.y,0]
local newmat = VrayMtl()
newmat.name = "Image__" + filenameFromPath o
local diff = bitmaptexture()
diff.filename = o
diff.alphasource = 2
diff.coords.realWorldScale = false
newmat.texmap_diffuse = diff
genplane.material = newmat
showTextureMap newmat newmat.texmap_diffuse on
)
) --end if
) --end function
fn createPictureFrame =
(
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
sm = sceneMaterials
smNames = for i = 1 to sm.count collect sm[i].name
for o in f do
(
local map = openbitmap o
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * (convertDisplayUToMaxU 0.5))/map.height
local genplane = Plane realWorldMapSize:off length:(convertDisplayUToMaxU 0.5) width:ratio transform:(matrix3 [1,0,0] [0,0,1] [0,1,0] [0,0,planeSize/2]) isSelected:off
genplane.lengthsegs = h_value
genplane.widthsegs = w_value
genplane.name = "PictureFrame__" + filenameFromPath o + "_picture"
local newmat = VrayMtl()
newmat.name = "Image__" + filenameFromPath o
local diff = bitmaptexture()
diff.filename = o
diff.alphasource = 2
diff.coords.realWorldScale = false
newmat.texmap_diffuse = diff
genplane.material = newmat
showTextureMap newmat newmat.texmap_diffuse on
local glassMat = undefined
local frameMat = undefined
local paperMat = undefined
if (finditem smNames "pF_Glass" == 0) then
(
glassMat = VrayMtl()
glassMat.name = "pF_Glass"
glassMat.Reflection = color 235 235 235
glassMat.Refraction = color 225 225 225
)
else
(
glassMat = sm[(finditem smNames "pF_Glass")]
)
if (finditem smNames "pF_Frame" == 0) then
(
frameMat = VrayMtl()
frameMat.Diffuse = color 22 22 22
frameMat.name = "pF_Frame"
frameMat.Reflection = color 205 205 205
frameMat.reflection_glossiness = 0.75
frameMat.reflection_subdivs = 25
frameMat.reflection_maxDepth = 2
)
else
(
frameMat = sm[(finditem smNames "pF_Frame")]
)
if (finditem smNames "pF_Paper" == 0) then
(
paperMat = VrayMtl()
paperMat.Diffuse = color 242 242 242
paperMat.name = "pF_Paper"
)
else
(
paperMat = sm[(finditem smNames "pF_Paper")]
)
local inSet = Rectangle length:genplane.length width:genplane.width cornerRadius:0 transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] (genplane.pos)) isSelected:on
inSet.name = "PictureFrame__" + filenameFromPath o + "_inset"
modPanel.addModToSelection (sweep ()) ui:on
inSet.modifiers[#Sweep].CurrentBuiltInShape = 2
inSet.modifiers[#Sweep][#Bar_Section].length = (convertDisplayUToMaxU 0.005)
inSet.modifiers[#Sweep][#Bar_Section].width = genplane.width/4.0
inSet.modifiers[#Sweep].PivotAlignment = 0
inSet.modifiers[#Sweep].SmoothSection = off
inSet.modifiers[#Sweep].SmoothPath = off
inSet.modifiers[#Sweep].yOffset = (convertDisplayUToMaxU -0.005)
inSet.modifiers[#Sweep].angle = -2
inSet.material = paperMat
local frame = Rectangle length:(genplane.length+2*(inSet.modifiers[#Sweep][#Bar_Section].width)) width:(genplane.width+2*(inSet.modifiers[#Sweep][#Bar_Section].width)) cornerRadius:0 transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] inSet.pos) isSelected:on
frame.name = "PictureFrame__" + filenameFromPath o + "_frame"
modPanel.addModToSelection (sweep ()) ui:on
frame.modifiers[#Sweep].CurrentBuiltInShape = 2
frame.modifiers[#Sweep][#Bar_Section].width = (convertDisplayUToMaxU 0.01)
frame.modifiers[#Sweep][#Bar_Section].length = (convertDisplayUToMaxU 0.04)
frame.modifiers[#Sweep].yOffset = (convertDisplayUToMaxU 0.01168)
frame.modifiers[#Sweep].angle = 0
frame.material = frameMat
local fGlass = Rectangle length:(genplane.length+2*(inSet.modifiers[#Sweep][#Bar_Section].width)) width:(genplane.width+2*(inSet.modifiers[#Sweep][#Bar_Section].width)) cornerRadius:0 transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] inSet.pos) isSelected:on
fGlass.name = "PictureFrame__" + filenameFromPath o + "_glass"
modPanel.addModToSelection (Extrude ()) ui:on
fGlass.modifiers[#Extrude].amount = (convertDisplayUToMaxU 0.005)
local back = copy fGlass
back.name = "PictureFrame__" + filenameFromPath o + "_backing"
fGlass.pos = fGlass.pos + [0, 0.7*(frame.modifiers[#Sweep][#Bar_Section].length) ,0]
back.pos = genplane.pos - [0, 0.1*(frame.modifiers[#Sweep][#Bar_Section].length) ,0]
fGlass.material = glassMat
back.material = paperMat
group #(fGlass, frame, inSet, genplane, back) name:("PictureFrame_" + (filenameFromPath o))
)
) --end if
) --end function
--rigged using a reference rectangle
fn createPictureFrame2 =
(
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
local oldPropogateToInst = InstanceMgr.autoMtlPropagation
InstanceMgr.autoMtlPropagation = false
sm = sceneMaterials
smNames = for i = 1 to sm.count collect sm[i].name
for o in f do
(
local imageName = filenameFromPath o
local map = openbitmap o
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * (convertDisplayUToMaxU 0.5))/map.height
local masterRect = Rectangle length:(convertDisplayUToMaxU 0.5) width:ratio cornerRadius:0 transform:(matrix3 [1,0,0] [0,0,1] [0,1,0] [0,0,planeSize/2]) isSelected:off
masterRect.name = "PictureFrame__" + imageName + "_master"
local imagePlane = reference masterRect
imagePlane.name = "PictureFrame__" + imageName + "_picture"
select imagePlane
modPanel.addModToSelection (Uvwmap ()) ui:on
imagePlane.modifiers[#UVW_Map].maptype = 0
imagePlane.modifiers[#UVW_Map].realWorldMapSize = off
imagePlane.modifiers[#UVW_Map].utile = 1
imagePlane.modifiers[#UVW_Map].vtile = 1
imagePlane.modifiers[#UVW_Map].wtile = 1
imagePlane.modifiers[#UVW_Map].length = (convertDisplayUToMaxU 0.5)
imagePlane.modifiers[#UVW_Map].width = ratio
imagePlane.modifiers[#UVW_Map].height = 1
local newmat = VrayMtl()
newmat.name = "Image__" + imageName
local diff = bitmaptexture()
diff.filename = o
diff.alphasource = 2
diff.coords.realWorldScale = false
newmat.texmap_diffuse = diff
imagePlane.material = newmat
showTextureMap newmat newmat.texmap_diffuse on
local glassMat = undefined
local frameMat = undefined
local paperMat = undefined
if (finditem smNames "pF_Glass" == 0) then
(
glassMat = VrayMtl()
glassMat.name = "pF_Glass"
glassMat.Reflection = color 235 235 235
glassMat.Refraction = color 225 225 225
)
else
(
glassMat = sm[(finditem smNames "pF_Glass")]
)
if (finditem smNames "pF_Frame" == 0) then
(
frameMat = VrayMtl()
frameMat.Diffuse = color 22 22 22
frameMat.name = "pF_Frame"
frameMat.Reflection = color 205 205 205
frameMat.reflection_glossiness = 0.75
frameMat.reflection_subdivs = 25
frameMat.reflection_maxDepth = 2
)
else
(
frameMat = sm[(finditem smNames "pF_Frame")]
)
if (finditem smNames "pF_Paper" == 0) then
(
paperMat = VrayMtl()
paperMat.Diffuse = color 242 242 242
paperMat.name = "pF_Paper"
)
else
(
paperMat = sm[(finditem smNames "pF_Paper")]
)
local inSet = reference masterRect
select inSet
inSet.name = "PictureFrame__" + imageName + "_inset"
modPanel.addModToSelection (sweep ()) ui:on
inSet.modifiers[#Sweep].CurrentBuiltInShape = 2
inSet.modifiers[#Sweep].PivotAlignment = 2
inSet.modifiers[#Sweep][#Bar_Section].length = (convertDisplayUToMaxU 0.005)
inSet.modifiers[#Sweep][#Bar_Section].width = masterRect.width/4.0
inSet.modifiers[#Sweep].SmoothSection = off
inSet.modifiers[#Sweep].SmoothPath = off
inSet.modifiers[#Sweep].xOffset = 0
inSet.modifiers[#Sweep].yOffset = (convertDisplayUToMaxU 0.005)
inSet.modifiers[#Sweep].angle = 2
inSet.material = paperMat
local frame = reference masterRect
select frame
frame.name = "PictureFrame__" + imageName + "_frame"
modPanel.addModToSelection (sweep ()) ui:on
frame.modifiers[#Sweep].CurrentBuiltInShape = 2
frame.modifiers[#Sweep].PivotAlignment = 1
frame.modifiers[#Sweep].angle = 0
frame.modifiers[#Sweep][#Bar_Section].width = (convertDisplayUToMaxU 0.01)
frame.modifiers[#Sweep][#Bar_Section].length = (convertDisplayUToMaxU 0.04)
frame.modifiers[#Sweep].yOffset = (convertDisplayUToMaxU 0.01168)
frame.modifiers[#Sweep].xOffset.controller = Float_Expression()
frame.modifiers[#Sweep].xOffset.controller.AddScalarTarget "inset" inSet.modifiers[#Sweep][#Bar_Section][#width]
frame.modifiers[#Sweep].xOffset.controller.AddScalarTarget "theta" inSet.modifiers[#Sweep][#angle]
frame.modifiers[#Sweep].xOffset.controller.SetExpression "(cos (radToDeg(theta))) * inset"
frame.material = frameMat
local fGlass = Rectangle length:1 width:1 cornerRadius:0 transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] inSet.pos) isSelected:on
fGlass.length.controller = Float_Expression()
fGlass.length.controller.AddScalarTarget "length" masterRect[#Object__Rectangle][#length]
fGlass.length.controller.AddScalarTarget "inset" inSet.modifiers[#Sweep][#Bar_Section][#width]
fGlass.length.controller.AddScalarTarget "theta" inSet.modifiers[#Sweep][#angle]
fGlass.length.controller.SetExpression "length + 2 * (cos (radToDeg(theta)) * inset)"
fGlass.width.controller = Float_Expression()
fGlass.width.controller.AddScalarTarget "width" masterRect[#Object__Rectangle][#width]
fGlass.width.controller.AddScalarTarget "inset" inSet.modifiers[#Sweep][#Bar_Section][#width]
fGlass.width.controller.AddScalarTarget "theta" inSet.modifiers[#Sweep][#angle]
fGlass.width.controller.SetExpression "width + 2 * (cos (radToDeg(theta)) * inset)"
fGlass.name = "PictureFrame__" + imageName + "_glass"
modPanel.addModToSelection (Extrude ()) ui:on
fGlass.modifiers[#Extrude].amount = (convertDisplayUToMaxU 0.005)
fGlass.pos = fGlass.pos + [0, 0.7*(frame.modifiers[#Sweep][#Bar_Section].length) ,0]
fGlass.material = glassMat
local back = instance fGlass
back.name = "PictureFrame__" + imageName + "_backing"
back.pos = masterRect.pos - [0, 0.1*(frame.modifiers[#Sweep][#Bar_Section].length) ,0]
back.material = paperMat
group #(fGlass, frame, inSet, masterRect, imagePlane, back) name:("PictureFrame_" + imageName)
)
InstanceMgr.autoMtlPropagation = oldPropogateToInst
) --end if
) --end function
fn createGalleryFrame =
(
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
sm = sceneMaterials
smNames = for i=1 to sm.count collect sm[i].name
for o in f do
(
local map = openbitmap o
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * (convertDisplayUToMaxU 0.5))/map.height
local genplane = Plane realWorldMapSize:off length:(convertDisplayUToMaxU 0.5) width:ratio transform:(matrix3 [1,0,0] [0,0,1] [0,1,0] [0,0,planeSize/2]) isSelected:on
genplane.lengthsegs = h_value
genplane.widthsegs = w_value
genplane.name = "GalleryFrame__" + filenameFromPath o + "_picture"
modPanel.addModToSelection (shell ()) ui:on
genplane.modifiers[#Shell].outerAmount = (convertDisplayUToMaxU 0.015)
genplane.modifiers[#Shell].straightenCorners = on
--genplane.pivot = [genplane.pivot.x,genplane.pivot.y,0]
local newmat = VrayMtl()
newmat.name = "Image__" + filenameFromPath o
local diff = bitmaptexture()
diff.filename = o
diff.alphasource = 2
diff.coords.realWorldScale = false
newmat.texmap_diffuse = diff
genplane.material = newmat
showTextureMap newmat newmat.texmap_diffuse on
local frameMat = undefined
if (finditem smNames "pF_Frame" == 0) then
(
frameMat = VrayMtl()
frameMat.Diffuse = color 22 22 22
frameMat.name = "pF_Frame"
frameMat.Reflection = color 205 205 205
frameMat.reflection_glossiness = 0.75
frameMat.reflection_subdivs = 25
frameMat.reflection_maxDepth = 2
)
else
(
frameMat = sm[(finditem smNames "pF_Frame")]
)
local frame = Rectangle length:genplane.length width:genplane.width cornerRadius:0 transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] (genplane.pos)) isSelected:on
frame.name = "PictureFrame__" + filenameFromPath o + "_inset"
modPanel.addModToSelection (sweep ()) ui:on
frame.modifiers[#Sweep].CurrentBuiltInShape = 1
frame.modifiers[#Sweep][#Angle_Section].angle_length = (convertDisplayUToMaxU 0.01)
frame.modifiers[#Sweep][#Angle_Section].angle_width = (convertDisplayUToMaxU 0.02)
frame.modifiers[#Sweep][#Angle_Section].angle_thickness = (convertDisplayUToMaxU 0.004)
frame.modifiers[#Sweep][#Angle_Section].angle_radius = 0
frame.modifiers[#Sweep][#Angle_Section].angle_radius2 = 0
frame.modifiers[#Sweep][#Angle_Section].angle_EdgeFillet = 0
frame.modifiers[#Sweep].PivotAlignment = 0
frame.modifiers[#Sweep].SmoothSection = off
frame.modifiers[#Sweep].SmoothPath = off
frame.modifiers[#Sweep].yOffset = 0
frame.modifiers[#Sweep].angle = 90
frame.material = frameMat
group #(frame, genplane) name:("GalleryFrame" + (filenameFromPath o))
)
) --end if
) --end function
fn createSIImagePlane =
(
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
for o in f do
(
local map = openbitmap o
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * planeSize)/map.height
local genplane = Plane realWorldMapSize:off length:planeSize width:ratio transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,planeSize/2]) isSelected:off
genplane.lengthsegs = h_value
genplane.widthsegs = w_value
genplane.name = "ImagePlane__" + filenameFromPath o
genplane.pivot = [genplane.pivot.x,genplane.pivot.y,0]
local newmat = VrayLightMtl()
local shellMat = Shell_Material()
local displayMat = Standardmaterial()
newmat.name = "Image__" + filenameFromPath o
shellMat.name = newmat.name + "_viewport"
displayMat.name = newmat.name + "_display"
local diff = bitmaptexture()
diff.filename = o
diff.alphasource = 2
diff.coords.realWorldScale = false
newmat.texmap = diff
newmat.texmap_on = true
newmat.compensate_exposure = true
displayMat.diffuseMap = diff
shellMat.originalMaterial = newmat
shellMat.bakedMaterial = displayMat
shellMat.viewportMtlIndex = 1
shellMat.renderMtlIndex = 0
genplane.material = shellMat
showTextureMap displayMat on
)
) --end if
) --end function
fn createAlphaImagePlane rendType =
(
print rendType
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
for o in f do
(
local map = openbitmap o
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * planeSize)/map.height
local genplane = Plane realWorldMapSize:off length:planeSize width:ratio transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,planeSize/2]) isSelected:off
genplane.lengthsegs = h_value
genplane.widthsegs = w_value
genplane.name = "ImagePlane__" + filenameFromPath o
genplane.pivot = [genplane.pivot.x,genplane.pivot.y,0]
local diff = bitmaptexture()
diff.filename = o
diff.alphasource = 2
diff.coords.realWorldScale = false
local op = bitmaptexture()
op.filename = o
op.coords.realWorldScale = false
op.coords.U_Tile = false
op.coords.V_Tile = false
op.rgbOutput = 1
op.monoOutput = 1
local newmat = VrayMtl()
if rendType == "Vray" then
(
print "vray"
newmat = VrayMtl()
newmat.name = "Image__" + filenameFromPath o
newmat.texmap_opacity = op
newmat.texmap_diffuse = diff
genplane.material = newmat
showTextureMap newmat newmat.texmap_diffuse on
)
else
(
print "std"
newmat = Standardmaterial()
print (classof newmat)
newmat.name = "Image__" + filenameFromPath o
newmat.opacityMap = op
newmat.diffuseMap = diff
try(newMat.babylontransparencyMode = 2)catch("No Babylon Plugin Found")
genplane.material = newmat
showTextureMap newmat newmat.diffuseMap on
)
)--end for
) --end if
)--end function
fn createMultiIDAnimation =
(
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
local map = openbitmap f[1]
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * planeSize)/map.height
local genplane = Plane realWorldMapSize:off length:planeSize width:ratio transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,planeSize/2]) isSelected:off
genplane.lengthsegs = h_value
genplane.widthsegs = w_value
genplane.name = "ImagePlane__" + filenameFromPath f[1]
genplane.pivot = [genplane.pivot.x,genplane.pivot.y,0]
local newmat = VrayMtl()
newmat.name = "Image__" + filenameFromPath f[1]
local texDiff = VRayMultiSubTex()
local texOp = VRayMultiSubTex()
texDiff.texmap_id = #()
texOp.texmap_id = #()
newmat.texmap_diffuse = texDiff
newmat.texmap_opacity = texOp
local idCount = #()
for i = 1 to f.count do
(
texDiff.texmap_id = (append idCount i)
texOp.texmap_id = idCount
local diff = bitmaptexture()
diff.filename = f[i]
diff.alphasource = 2
diff.coords.realWorldScale = false
diff.coords.U_Tile = false
diff.coords.V_Tile = false
local op = bitmaptexture()
op.filename = f[i]
op.coords.realWorldScale = false
op.coords.U_Tile = false
op.coords.V_Tile = false
op.rgbOutput = 1
op.monoOutput = 1
texDiff.texmap[i] = diff
texDiff.texmap_on[i] = true
texDiff.texmap_mapOn[i] = true
texDiff.texmap_mult[i] = 100
texDiff.texmap_color[i] = color 0 0 0
texOp.texmap[i] = op
texOp.texmap_on[i] = true
texOp.texmap_mapOn[i] = true
texOp.texmap_mult[i] = 100
texOp.texmap_color[i] = color 0 0 0
)
genplane.material = newmat
addModifier genplane (Materialmodifier ())
animate on
(
sliderTime = 0
genplane.modifiers[1].materialID = 1
sliderTime = (f.count - 1 )
genplane.modifiers[1].materialID = f.count
)
genplane.modifiers[1].materialID.controller = linear_float ()
setBeforeORT genplane.modifiers[1].materialID.controller #cycle
setAfterORT genplane.modifiers[1].materialID.controller #cycle
)
)
fn createSilhImagePlane =
(
local f = collectImgFiles()
if f != undefined then --if the user did not cancel
(
for o in f do
(
local map = openbitmap o
local planeSize= convertDisplayUToMaxU 1.6
local ratio = (map.width * planeSize)/map.height
local genplane = Plane realWorldMapSize:off length:planeSize width:ratio transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,planeSize/2]) isSelected:off
genplane.lengthsegs = h_value
genplane.widthsegs = w_value
genplane.name = "ImagePlane__" + filenameFromPath o
genplane.pivot = [genplane.pivot.x,genplane.pivot.y,0]
local newmat = VrayMtl()
newmat.name = "Image__" + filenameFromPath o
local op = bitmaptexture()
op.filename = o
op.coords.realWorldScale = false
op.coords.U_Tile = false
op.coords.V_Tile = false
--op.rgbOutput = 1
--op.monoOutput = 1
newmat.texmap_opacity = op
genplane.material = newmat
showTextureMap newmat newmat.texmap_opacity on
)--end for
) --end if
)--end function
rollout ImagePlane_RO "Create Image Plane" width:250 height:220
(
spinner w_spinner "W Segs" range:[1,100,w_value] type:#integer across:2
spinner h_spinner "H Segs" range:[1,100,h_value] type:#integer
button create_btn "Simple Image Plane" width:200 height:16
button create_a_btn "Image Plane w/ Alpha" width:200 height:16
button create_a_std_btn "Image Plane w/ Alpha (Standard)" width:200 height:16
button create_si_btn "Self Illum Image Plane" width:200 height:16
button create_silh_btn "Silhouette Image Plane" width:200 height:16
button create_AM_btn "Animated MultiTex Plane" width:200 height:16
button create_PF_btn "Picture Frame" width:200 height:16
button create_GF_btn "Gallery Frame" width:200 height:16
on create_btn pressed do
(
createImagePlane()
)
on create_PF_btn pressed do
(
createPictureFrame2()
)
on create_GF_btn pressed do
(
createGalleryFrame()
)
on create_a_btn pressed do
(
createAlphaImagePlane "Vray"
)
on create_a_std_btn pressed do
(
createAlphaImagePlane "Standard"
)
on create_si_btn pressed do
(
createSIImagePlane()
)
on create_silh_btn pressed do
(
createSilhImagePlane()
)
on create_AM_btn pressed do
(
createMultiIDAnimation()
)
on w_spinner changed n do
(
w_value = n
)
on h_spinner changed n do
(
h_value = n
)
) --end rollout
on execute do
(
if h_value == undefined then h_value = 1
if w_value == undefined then w_value = 1
try( DestroyDialog ImagePlane_RO) catch ()
createDialog ImagePlane_RO
)--end on execute
) --end script