[Closed] scripted plugins?
So I have a scripted plugin that still works well in max 2016
Its a “simple manipulator plugin”
However it doesn’t seem to recognise any of the paramaters in “parameters main” block in max 2019.
Have there been some changes to scope or something in this since 2016?
look into persistent global variables for variables that save and load with the scene
to save the arrays i would use matrix3tabs in a parameter block
mark
Hi,
I would probably use a specific naming for the trees, instead of sticking global arrays in every max file.
So the trees would be like this: myNewTree001, myNewTree002, … which then can be collected like so: $myNewTree*
Light
let me take a step back here: you probably don’t need maxscript to have the trees facing the camera, you can use a lookat constraints for this. you will want to set these up using maxscript, but you don’t need a script running on viewport redraw or anything
in max you can’t directly disable seperate axis for the lookat constraint to have them only rotate on one axis like in maya’s aim constraint (i assume you tried this as you’re coming from maya), but you can get this behavior anyway. using the compiled lookat constraint will be much more interactive then maxscript… so i think you should definitely use it.
the setup is simple:
- create a point helper at the pivot of your planes, parent the planes to the helpers
- put a lookat constraint on the point helpers, add the cam as a target
- disable the inheritance flags for the two rotation axis you don’t need… this makes the plane only rotate on one axis
to answer your question about barking up trees: yes, i think you are barking up the wrong one, or at least up a tree that is more complicated than it needs to be from my point of view i’d make this a simple macroscript, and i’d also use a naming scheme like light suggested so you can easily collect the trees after they’ve been created without worrying about data stored within the scene.
look at 'script controllers'. You can replace the default controller (like euler, tcb etc) with your own custom controller.
A simple method would be to use the ‘user defined properties’ of the object. Check the maxscript help under ‘user-defined properties – node methods’
When you open you maxscript tool it could simple scan through all the objects in the scene looking for tree types.
something like
for obj in geometry where [font=Courier New](getUserProp[/font][font=Courier New] obj “BigTree[/font]”) == true do append myBigarray obj
If you want to do more complex stuff then you need to check out ‘custom attributes’
That depends on how many trees you placing and how much tweeking you want to do.
If you doing a one off simple scene then the method Aeron descibed would be fine.
If you need to do this a lot then I would consider a script. (Not least because custom attributes are very powerful and well worth learning if you’re into that kind of thing.)
N.B
if you do try using custom attributes it’s worth noting that
[color=Orange]custAttributes.add $sphere01 CaTest
Means that all instances of [/color]$sphere01 will gain a shared custom attribute.But…
[color=Orange]
[/color][color=Orange]custAttributes.add $sphere CaTest BaseObject:false
Means that [/color]$sphere01 will gain a unique custom attribute, even if it has instances.
(this had me banging my head for days…)