#paramBlock2 scripted plugin parameter type. How to use?

#paramBlock2 scripted plugin parameter type. How to use?

AndyVanDalsem
Enthusiast Enthusiast
480 Views
6 Replies
Message 1 of 7

#paramBlock2 scripted plugin parameter type. How to use?

AndyVanDalsem
Enthusiast
Enthusiast

Hi guys,
I have maybe a stupid question but I can't find any examples anywhere. 

In the help docs for scripted plugins clauses, it says available since 2018 there's a parameter type called #paramBlock2.

 

parameters main rollout:params
(
size type:#worldUnits ui:size default:150
paramTest type:#paramBlock2 -- <-- How do I use this?
)


But I can't really see how to use it. Can anyone point to some example usages that I could look at?

In the code above for example, now that there's a parameter `paramTest`, how do I populate it? Do I assign it an instance of another object's params?

In that case, I'm not even sure how to easily/safely  access another objects paramBlock. You have this way:

<void>paramPublishMgr.addParameterBySubNum <maxObject>paramParent <index>paramSubnum

 But you have to have the obj selected in trackview.

This way can return the paramBlock:

(refs.dependsOn $.baseobject)

But it can return an array of multiple blocks or other nodes and I'm not sure how to filter just the params, or even how to figure out which params are the ones I'm looking for. 

 

But, say I could isolate the params, would I assign them to my #paramBlock2 item type like this?
$obj_A.paramTest = $obj_B.params?

Or can I define the params in a variable somewhere and assign it that way?

storedParams = parameters stored ( range type:#float default:25.5 )

$obj_A.paramTest = storedParams

 

Can paramTest's populated block then be linked to UI elements?

Anyway, thanks for any examples or links to documentation. 

0 Likes
Accepted solutions (2)
481 Views
6 Replies
Replies (6)
Message 2 of 7

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

for example, cust attributes have paramblock2s 

global CAPB2 = attributes CAPB2 attribid:#(0x00de01, 0xde00de) 
(
	parameters params 
	(
		power type:#float default:1.0
		
		on power set val do
		(
			format "power set >> %\n" val
		)
	)
)

ca = createinstance CAPB2
ca.power

getproperty ca #power
ca.power = 0.5
setproperty ca #power 0.25

pb2 = refs.getreference ca 1
classof pb2 

getpropnames pb2  

 

Message 3 of 7

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

another example - a built-in modifier

(
	m = Bend()
	for k=1 to refs.getNumRefs m do format "index:% ref:%\n" k (refs.getreference m k)
)

:


Message 4 of 7

AndyVanDalsem
Enthusiast
Enthusiast

This is great, thank you. Exactly what I needed.  

0 Likes
Message 5 of 7

larryminton
Alumni
Alumni

To a large extent #paramBlock2 and #paramBlock2tab aren't that applicable to maxscript, and are more for c++ sdk completeness and testing.

In the c++ world #paramBlock2tab is used for things like the Conform modifier and the Boolean modifier to store information on each operand.

To be similarly applicable in maxscript, would need a way to specify for each 'parameters' block whether it should not be automatically created when the plugin instance is created, and a way to create it so that it could then be assigned/added to the #paramBlock2/#paramBlock2tab parameter.


Larry Minton
Principal Engineer, M&E-Design Animation
Message 6 of 7

AndyVanDalsem
Enthusiast
Enthusiast

Ah, ok. I think I understand.   

That's kind of what I was thinking about doing with it was storing operand-type data in the #paramBlock2 parameter. I didn't even know there was a #paramBlock2tab type! It's not shown anywhere in the Maxscript docs that I could find.

I'm going to play around with it just because I'm curious, but it's good to know it's more of a c++ thing.

Thanks for the info!

0 Likes
Message 7 of 7

larryminton
Alumni
Alumni

fixing doc...

|`#paramBlock2Tab`|available since 3ds Max 2018|
|`#point2Tab`|available since 3ds Max 2018|

Larry Minton
Principal Engineer, M&E-Design Animation