Schlagwort-Archive: maxscript

Ä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

Objekt-Abmessungen in Viewport anzeigen

Mit diesem Script lassen sich die Abmessungen selektierter Objekte anzeigen.
Das Script ist als Button definiert, wenn es per drag&drop in 3Ds Max gezogen wurde ist es zu finden unter Customize User Interface / Kategorie: jb_scripts.

Download: jb_scripts-OBJDimension

jb_objDimension

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
/*
Get Object Dimension from jb_alvarado | 2013 | www.pixelcrusher.de
no Copyright restriction 
use it at your on risk
 
Tested in 3ds Max 2013/2014
 
This Script get the dimension from selection and draw this in the current screen.
For the best use copy it in the scripts folder, then drag and drop it in the 3ds max screen, after that go to:
Customize/Customize User Interface/Toolbars/Category/jb_scripts/Live Dimension in Viewport
and drag this in your Toolbar.
*/
 
macroScript OBJDimension
category:"jb_scripts"
tooltip:"Live Dimension in Viewport"
buttonText:"Dimension"
(
    global GW_displayObjectNames
    on isChecked return ::drawInViewportEnabled
    on execute do (
        if ::drawInViewportEnabled != true and ::drawInViewportEnabled != false do ::drawInViewportEnabled = false
        ::drawInViewportEnabled = not ::drawInViewportEnabled
        if ::drawInViewportEnabled then (            
            unregisterRedrawViewsCallback GW_displayObjectNames
            fn GW_displayObjectNames = (
                    if ( selection.count == 1 ) then (
                        if ( superclassof selection[1] == shape ) then (
                            local shapeLength = " | Shapes Length: " + ( units.formatValue ( curveLength selection[1] ) as string )
                            ) else (
                                local shapeLength = ""
                                )
                                
                        bound = nodeGetBoundingBox selection[1] selection[1].transform
                        dim = ( bound[2] - bound[1] )
 
                        local objX = ( units.formatValue dim.x as string )
                        local objY = ( units.formatValue dim.y as string )
                        local objZ = ( units.formatValue dim.z as string )
                        
                        if selection[1].name.count > 16 then (
                            selName = "[" + ( substring selection[1].name 1 16 ) + ".]"
                            ) else (
                                selName = "[" + selection[1].name + ".]"
                                )
    
                        gw.wText [14,33,0] ("Dimension From " + selName + ":  X: " + objX + " | Y: " + objY + " | Z: " + objZ + shapeLength) color: ( color 229 204 25 )
                        ) else if ( selection.count > 1 ) then (
                            local objMin = selection.min
                            local objMax = selection.max
                            local objX = ( units.formatValue ( objMax.x - objMin.x ) as string )
                            local objY = ( units.formatValue ( objMax.y - objMin.y ) as string )
                            local objZ = ( units.formatValue ( objMax.z - objMin.z ) as string )
                            gw.wText [14,33,0] ("Dimension From Selection:  X: " + objX + " | Y: " + objY + " | Z: " + objZ ) color: ( color 229 204 25 )
                            )
                gw.enlargeUpdateRect #whole
                )
            registerRedrawViewsCallback GW_displayObjectNames
        ) else    (
            shapeLength = undefined
            objMin = undefined
            objMax = undefined
            objX = undefined
            objY = undefined
            objZ = undefined
            unRegisterRedrawViewsCallback GW_displayObjectNames
            forceCompleteRedraw()
            )
        )        
)