PDA

View Full Version : Bunch of maxscript questions....


Gibbz
11-02-2005, 11:12 AM
ok decided to do a bunch of max script questions as these things i cannot seem to get working...

1. Ok i can get the matID from the selected face, but i cannot set the matID for the selected face in edit poly. Im currently trying to use....

$.EditablePoly.setMaterialIndex 1 --set material id on selected face to 1


2. I want do do my own spinner for material ID on my dialog(hence the above question), does "on myMaterial changed do" activate the script when changing, using spinners etc?


3. The following code work when i cycle through it, but when i run the script it doesnt work... The same issue when doing a planarx, planary, planar z etc...


on myPlanarView pressed do --facemap
(
mySelection = $.getselection #Face --get currently selected polys
subobjectLevel = 0
modPanel.addModToSelection (Unwrap_UVW ()) ui:on
subobjectLevel = 3
$.modifiers[#unwrap_uvw].unwrap.selectPolygons mySelection --select original selection
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 1 --planar map mode
$.modifiers[#unwrap_uvw].unwrap5.mappingAlign 2 --z map
$.modifiers[#unwrap_uvw].unwrap5.mappingAlignToView()
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 0
macros.run "Modifier Stack" "Convert_to_Poly"
subobjectLevel = 4
$.EditablePoly.SetSelection #Face mySelection --select original selection
)


4. Is there a way to when selecting 2 faces find which face is selected first, then find the shared edge in the uv dialog?

Thanks again guys :) im getting there... slowly :D

Blue
11-04-2005, 06:32 AM
1. Ok i can get the matID from the selected face, but i cannot set the matID for the selected face in edit poly. Im currently trying to use....

$.EditablePoly.setMaterialIndex 1 --set material id on selected face to 1

Looking at the line above it is missing the faceFlags after the index number if you just add a space and a 1 it should work.
$.EditablePoly.setMaterialIndex 1 1
You can also try:
polyOp.setFaceMatID $ (polyOp.GetFaceSelection $) 1

Blue
11-04-2005, 06:40 AM
2. I want do do my own spinner for material ID on my dialog(hence the above question), does "on myMaterial changed do" activate the script when changing, using spinners etc?

You seem to be missing the argument variable, the following should set the matId when the spinner changes:
on myMaterial changed val do $.EditablePoly.setMaterialIndex val 1

Blue
11-04-2005, 06:50 AM
3. The following code work when i cycle through it, but when i run the script it doesnt work... The same issue when doing a planarx, planary, planar z etc...


on myPlanarView pressed do --facemap
(
mySelection = $.getselection #Face --get currently selected polys
subobjectLevel = 0
modPanel.addModToSelection (Unwrap_UVW ()) ui:on
subobjectLevel = 3
$.modifiers[#unwrap_uvw].unwrap.selectPolygons mySelection --select original selection
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 1 --planar map mode
$.modifiers[#unwrap_uvw].unwrap5.mappingAlign 2 --z map
$.modifiers[#unwrap_uvw].unwrap5.mappingAlignToView()
$.modifiers[#unwrap_uvw].unwrap5.mappingMode 0
macros.run "Modifier Stack" "Convert_to_Poly"
subobjectLevel = 4
$.EditablePoly.SetSelection #Face mySelection --select original selection
)


This block actually worked just fine for me, what is it not doing for you? Also instead of using the macros.run "Modifier Stack" "Convert_to_Poly" command, the more direct route would be to use convertToPoly $ , its just a suggestion, the macro way will work too of course.

Gibbz
11-04-2005, 07:09 AM
the planar map doesnt work, basically its a script that does a planar map from the camera view. It doesnt work on my home pc or work pc... the line that fails is...

$.modifiers[#unwrap_uvw].unwrap5.mappingAlignToView()

Blue
11-05-2005, 02:12 AM
Some kind of thank you would have been nice for the above answers. Without this it makes debugging your work difficult.

You should make sure that the normalize uv option is off when you do the align to viewport function.
$.modifiers[#unwrap_uvw].setNormalizeMap false

Gibbz
11-05-2005, 02:20 AM
Yes thanks to every on this forum for my millions of n00b maxscipt posts :)

For some reason my max was buggy, it needed a reinstall to work. It was causing no end of odd problems...

Is it possible other scripts can interfere with the maxscript somehow?

Blue
11-05-2005, 05:18 AM
Global definitions (functions or variables) can cause any number of problems with other scripts.

CGTalk Moderation
11-05-2005, 05:19 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.