Jump to content

Get Texture Index PopUpMenu


Recommended Posts



is there in the meanwhile a good solution for the GetTexture problem where previously selected Textures where locked to the index of the PopupList not the Name/ID of the texture itself ?


In the end the applied textures got kind of randomizes as soon as new materials got imported in the file and sorted near enough at the top of the list to affect the indexing of the list


Is there a good solution for that ?


See here:






Edited by heikolistische
Link to comment


i think i got a solution. I modified the "Symbol From Folder" Script by @Antonio Landsberger  to work with Materials.

In my case now Materials keep the same even new ones get imported. 

Does it work for everyone else too ?

File is attached🙂

class Params(metaclass = Marionette.OrderedClass):
	this = Marionette.Node( 'Materialauswahl' )
	this.SetDescription( "Returns the name of a symbol chosen via selection dialog with previews of the symbols in the current document. If a folder name is given, only its content is shown." )	

	#OIP Controls
	# Holds the selected symbol name
	SymbolName = Marionette.OIPControl( 'Material', Marionette.WidgetType.TextStaticParam, '<None>')
	SymbolName.SetDescription( "Shows a dialog, where a symbold can be selected." ) 
	Int = Marionette.OIPControl( 'Material ändern', Marionette.WidgetType.Button, 'script1', 'description')
	Int.SetDescription( "Shows symbol selection dialog" ) 
	#Output Ports
	out = Marionette.PortOut( 'sMat' )   
	out.SetDescription( "Name of the chosen symbol" )

#END class

def RunNode(self):	
	sym = self.Params.SymbolName.value

	self.Params.out.value = sym
#END def RunNode
def script1(self):
	self.Params.out.blocked = True

	def SymbolSelDialog( showall ):

		SetupDialogC	= 12255	 # Dialog open event ID
		CloseDialogC	= 12256	 # Dialog close event ID

		# alignment constants
		kRight		= 1
		kBottom		= 2
		kLeft		= 3
		kColumn		= 4
		kResize		= 0
		kShift		= 1

		# default and cancel button IDs
		kOK			= 1
		kCancel		= 2

		# control IDs
		kSymPopup	= 4

		def DialogHandler( item, data ):
			# setup of the dialog content ...
			if ( item == SetupDialogC ):
				resourceListID, numItems = vs.BuildResourceList( 97, 0, '' )
				if showall:		# show all symbols
					for cnt in range( numItems + 1 ):
						int = vs.InsertImagePopupResource( dialog, kSymPopup, resourceListID, cnt )
					#END for	
				else:			# show only symbols in user defined symbol folder
					for cnt in range( numItems + 1 ):
						tempStr = vs.GetNameFromResourceList( resourceListID, cnt )
						objH	= vs.GetObject( tempStr )
						parentH = vs.GetParent( objH )
						if ( objH != None ) :
							int = vs.InsertImagePopupResource( dialog, kSymPopup, resourceListID, cnt )
					#END for
				#END if
			elif ( item == kOK ):
				objIndex = vs.GetImagePopupSelectedItem( dialog, kSymPopup )
				objName  = vs.GetImagePopupObject( dialog, kSymPopup, objIndex )
				# Write the selected symbol to the OIP control for script usage
				self.Params.SymbolName.SetValue( objName )
			#END if
		#END def DialogHandler()

		dialog = vs.CreateLayout( 'Dialog', True, 'OK', 'Cancel' )

		# create controls
		vs.CreateThumbnailPopup( dialog, kSymPopup )

		# set relations
		vs.SetFirstLayoutItem( dialog, kSymPopup )

		if ( vs.RunLayoutDialog( dialog, DialogHandler ) == 1 ):

	#END def SymbolSelDialog()
	SymbolListID, numSymItems = vs.BuildResourceList( 97, 0, '' ) #make list of all symbols
	#-- if there are no symbols at all, show error message and abort --
	if ( numSymItems == 0 ):
			vs.AlertCritical( "There are no Materials in this document. Please add some and try again." )

	elif (numSymItems > 0):
		SymbolSelDialog( True ) #show all Materials	




randomized Texture Fix Try 1.vwx

  • Like 2
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...