From\To selected objects - Get\Assign material

The subject must work with Slate editor via shortcut.
Could anybody help please?

Comments

Comment viewing options

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

Works like a charm thank you

Works like a charm thank you so much Jahman, will definitely use it a hundred times per day.
Now may I kindly ask you to make "Select by active (SME) material" :) ?

jahman's picture

.

should work

macroScript SelectNodesByMaterial
category:"Jahman"
tooltip:"SME select nodes by material"
(
	fn GetSMESelection nodes:false =
	(
		local index = sme.activeView
		local viewNode = sme.GetView index	
		local SME_Selection = #()
 
		if index > 0 do
		(
			local tv = trackViewNodes[#sme][index]
 
			for n = 1 to tv.numSubs do
			(	
				local ref   = tv[n].reference									
				local _node = viewNode.GetNodeByRef ref
 
				if _node != undefined and _node.selected do append SME_Selection ( if nodes then #( ref, _node ) else ref )
 
			)
		)
 
		SME_Selection
 
	)
 
	on execute do if SME.IsOpen() do
	(
		local nodes = #()
		for m in GetSMESelection() do join nodes (refs.dependentNodes m)		
		select nodes		
	)
)
1rv's picture

Made my day. Thanks a ton :)

Made my day. Thanks a ton :)

jahman's picture

.

1rv's picture

I'd recommend to post them so

I'd recommend to post them so it won't get buried in Wanted sub-forum,
Best

jahman's picture

:D

Those who want something special should invest some of their time to google things up as I'm too lazy to test these scripts, upload 'em, make a description etc...

1rv's picture

One tiny and hopefully :)

One tiny and hopefully :) final request: when user hits a dedicated shortcut, could the script open SME if its closed?

jahman's picture

.

can't edit my prev posts, unfortunately
replace it with this:

on execute do
(
    if not SME.IsOpen() do SME.Open()
 
    local nodes = #()
    for m in GetSMESelection() do join nodes (refs.dependentNodes m)		
    select nodes		
)
1rv's picture

I get:-- Syntax error: at ),

When SME is closed I get an error:

-- Syntax error: at ), expected
-- In line: )

After my lame edit the mcr looks like:

macroScript SmePickMaterialFromSelection
category:"Jahman"
tooltip:"SME get material from selection"
on execute do
(
if not SME.IsOpen() do SME.Open()

local nodes = #()
for m in GetSMESelection() do join nodes (refs.dependentNodes m)
select nodes
)

What to fix?
P.S. Still works fine if SME is open

jahman's picture

.

link

Comment viewing options

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