mapDroper

4 votes
Version: 
2.1
Date Updated: 
08/21/2012
Author Name: 
Branko Živković

----------------------------------------------------------------------------------------------------------- [version 2]

This little tool allows you to put a texture with drag and drop method from any folder to
specified slot of the Material Editor.

Additional Info: 

Just drag & drop map file to script label box (Drop Here).
If file is valid script will throw "OK" else "NO".
Not supports multiple draged files.
Supported materials are: Standard, VRayMtl, Arch & Design
Supported map types are: *.hdr, *.exr, *.jpg, *.tga, *.tif, *.bmp, *.png, *.jpeg, *.psd.
See the image below to see how it works:

This script is requested by roamn

Version Requirement: 
2010+
AttachmentSize
bga_mapdroper_v1.0.ms1.75 KB
bga_mapdroper_v2.1.ms5.36 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jaber_Zaker_Joybari's picture

Another usage of this beautiful script-- Easy drag and drop impo

Hi Branko

Thanks for sharing this beautiful script . I just reuse your script to easy drag and drop Image importer. Here it is

/*//////////   SCRIPT:   mapDroper v.1.0   //////////*/
/*//////////   WRITTEN BY:   Branko Zivkovic   //////////*/
/*//////////   EMAIL:   [email protected]   //////////*/
(
	try(destroydialog ::mapDrop) catch()
	rollout mapDrop "Easy Image Importer"
	(
		local mapExt = #(".hdr", ".exr", ".jpg", ".tga", ".tif", ".bmp", ".png", ".jpeg", ".psd"), dropState = off		
		local stdProps = #("diffuseMap")
		local classArr = #(Standardmaterial)
		dotnetcontrol drop "Label" pos:[5,5] width:150 height:40
		dotnetcontrol props "CheckedListBox" pos:[5,50] width:140 height:10
		radioButtons 'window_' "Window" pos:[10,60] width:78 height:30 labels:#("Top","Front") columns:2 align:#left
 
		mapped fn trimArr arr &new = (append new (substring arr 8 100))			
 
		fn checkIsImage arg arr =
		(
			arg.Data.ContainsFileDropList() and (arg.Data.GetFileDropList()).count == 1 and \
			(for ext in arr where matchpattern ext pattern:(getFilenameType (arg.Data.GetFileDropList()).item[0]) collect ext).count != 0
		)
		fn updateMat propctrl mtl map idx =
		(
			for ci in 0 to propctrl.CheckedItems.count-1 do
			(
				slotName = if idx == 2 then ("texmap_"+propctrl.CheckedItems.item[ci]) else propctrl.CheckedItems.item[ci]
				setProperty mtl slotName map
			)
		)
 
 
		on mapDrop open do
		(
			props.BackColor = drop.BackColor = (dotNetClass "System.Drawing.Color").FromArgb 40 40 40
			props.ForeColor = drop.ForeColor = (dotNetClass "System.Drawing.Color").FromArgb 200 200 200
			props.BorderStyle = drop.BorderStyle = (dotNetClass "BorderStyle").FixedSingle
			drop.Font = (dotNetObject "System.Drawing.Font" "Impact" 20)
			drop.TextAlign = drop.TextAlign.MiddleCenter
			props.HorizontalScrollbar = props.MultiColumn = false
			drop.Text = "Drop Image " ; drop.AllowDrop = props.CheckOnClick = true
			props.Items.AddRange stdProps
			--format "itm = %\n" mtltype.selection 
		)
 
		on drop DragOver s arg do
		( 
			arg.Effect = if checkIsImage arg mapExt then
			( 
				s.Text = "Done" ; dropState = on ; arg.Effect.Move
			) 
			else 
			(
				s.Text = "NO" ; dropState = off ; arg.Effect.None
			)
		)
 
		on drop DragDrop arg do
		(
		imgFile = (arg.Data.GetFileDropList()).item[0]
		tempMap = openBitMap imgFile
		imgPlane = plane name:(uniqueName("hhh" + (getfilenameFile imgFile))) length:(tempMap.height) width:(tempMap.width) lengthsegs:1 widthsegs:1 mapCoords:true isselected:true
 
------Import an image	START		
		case window_.state of
		(
			------Top
			1:(	imgPlane.transform = matrix3 1)
			-----Front 
			2:(imgPlane.transform = RotateXMatrix 90 )
		)	
 
		imgMaterial = standard()
		imgMaterial.name = imgPlane.name
		imgTexture = bitmaptexture()
		imgTexture.bitmap = tempMap
		imgMaterial.diffuseMap = imgTexture
		imgPlane.material = imgMaterial
		imgMaterial.twoSided = on
		showTextureMap imgMaterial imgMaterial.diffuseMap on
		close tempMap			
		)
	)
 
 
	createdialog mapDrop 160 100 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
)

If you are not OK with this just tell me to delete this post.

Thank again for sharing all your beautiful script

vidivini500's picture

...

Hi Barigazy, very nice script!
Is possible to add the option of drop more than one map at the same time?
Would be great.
Thanks for your work

barigazy's picture

...update 2.1

Bug is fixed

barigazy

brainsgonedead's picture

VRAY Error

I use 3D Max 2017, but not VRAY so this shows a VRAY MTL error when I go to install. Hopefully this can be fixed...

barigazy's picture

Thanks Kim. Glad you like it

Thanks Kim. Glad you like it

barigazy

kimarotta's picture

Good Work... nice.

Good Work... nice.

kimarotta.com.br
3d Artist  

barigazy's picture

I update the script.See

I update the script.See image, it very simple to use

barigazy

n0name's picture

how to use this script?

how to use this script?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.