Ändern der Texturtypen

Mit diesem Script lassen sich die Textur-Endungen ändern. Z.B. von tif nach tga. Werden die alten Texturen nicht entfernt „Condense Material Editor“ verwenden.

Download: jb_change_textureExtension

texExtChg

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
macroScript ExtensionChange
category:"jb_scripts"
ButtonText:"TexExtensionChange"
Tooltip:"TexExtensionChange" 
(--macro begins
local TexExtensionChange
(
 
	fn GetBitmapTextures theObjects =
	(
		texMaps = #()
		for obj in theObjects do
		(
			join texMaps (getClassInstances bitmapTexture target:obj asTrackViewPick:off)
		)
		makeUniqueArray texMaps
	)
	texMaps = (GetBitmapTextures objects)
 
	fn changeOutExt inExt outExt =
	(
	for texMap in texMaps do (
		objName = getFilenameFile texMap.filename
 
		-- remove the point in string
		inExt = trimleft inExt "."
		outExt = trimleft outExt "."
 
		-- add a point and change the extension
		inex = "."+inExt
		if getFilenameType texMap.filename == inex do texMap.filename = (objName + "." + outExt)
	)
)
)
 
rollout TexExtensionChange "Tex Extension Change" 
(			 
	label lbl1 "Change Texture Extension" pos:[10,6] width:193 height:20
	editText edt1 "from" pos:[11,27] width:90 height:20
	editText edt2 "to" pos:[115,27] width:90 height:20
 
	button btn1 "Change" pos:[219,27] width:130 height:20
	 on btn1 pressed do (
		  with undo on
			(
			changeOutExt edt1.text edt2.text
			)
		)
	button btn2 "Condense Material Editor" pos:[219,54] width:130 height:20
	 on btn2 pressed do (
		  with undo on
			(
				defaultMtlLibFile = MeditUtilities.getDefaultLibraryFile()
				if defaultMtlLibFile != undefined do
					(
						defaultMtlLib = loadTempMaterialLibrary defaultMtlLibFile
						usedMtls = #()
						for i in 1 to meditMaterials.count do
							(
								if MeditUtilities.isMaterialInUse meditMaterials[i] == true do
								append usedMtls meditMaterials[i]
							)
							global _meditMaterialsBeforeReset = #()
							for i in 1 to meditMaterials.count do
								(
									append _meditMaterialsBeforeReset meditMaterials[i]
									if i <= usedMtls.count then
									meditMaterials[i] = usedMtls[i]
									else if i <= defaultMtlLib.count then
									meditMaterials[i] = defaultMtlLib[i]
									else
									meditMaterials[i] = defaultMtlLib[defaultMtlLib.count]
								)
					)				
			)
		)	
	)
	 createDialog TexExtensionChange 356 80
)--macro end

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.