uvwmap gizmo to ojbect center

i made uvwmap and some moved gizmo

i would like to uvwmap gizmo -> object center again

always thank you for good script and good advice ~

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Haider of Sweden's picture

.

EPoly Slice

New Suggestion:
Align Slice plane to poly face

.
Bugs
When running resetEPM_SlicePlane(), the interface refreshes shortly and then turns off the Slice Plane button
- I suggest it should simply reset the Slice Plane gizmo, leaving the user with the Slice Plane button like it was before..

Kind regards
Haider
www.haider.se

barigazy's picture

...

@Haider of Sweden
Now you see why this need to be separate fn from resetModyGizmoTm

;)

bga

barigazy's picture

...part4 ei. next step2 :)

• • • EPoly SlicePlane Reseter Fn • • •

This fn works on multiple selected objects (PolyMeshObject and Editable_Poly)

fn getMody node modyClass: = if node.modifiers.count > 0 do
(
	local mody
	for m in node.modifiers while mody == undefined where iskindof m modyClass do mody = m ; mody
)
fn setCommandPanelRedraw act =
(
	WM_SETREDRAW = 0x000B
	windows.sendmessage (windows.getchildhwnd #max "Command Panel")[1] WM_SETREDRAW act 0
) 
fn resetEPM_SlicePlane = if selection.count != 0 do
(
	local nodesPairs = dataPair solo:#() mody:#()
	for o in selection do
	(
		if isKindOf o Editable_Poly then append nodesPairs.solo o else 
		(
			if (mody = getMody o modyClass:Edit_Poly) != null do append nodesPairs.mody #(mody, o)
		)
	)
	setCommandPanelRedraw 0
	if nodesPairs.solo.count != 0 do
	(
		if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
		with redraw off for o in nodesPairs.solo do o.ResetSliceplane()
	)
	if nodesPairs.mody.count != 0 do
	(
		select (for i = 1 to nodesPairs.mody.count collect nodesPairs.mody[i][2])
		if getCommandPanelTaskMode() != #modify do setCommandPanelTaskMode mode:#modify
		for i = 1 to nodesPairs.mody.count do 
		(
			modPanel.setCurrentObject nodesPairs.mody[i][1] node:nodesPairs.mody[i][2] ui:on
			nodesPairs.mody[i][1].ResetSliceplane()
		)
	) ; setCommandPanelRedraw 1
)
resetEPM_SlicePlane()

bga

barigazy's picture

...

What's next?

:)

bga

Haider of Sweden's picture

.

Forgive me for being such an amateur, but it takes some time for me to understand how I run the script and such.

First some basic questions.
Previously you used resetModyGizmoTm selection while later, you used resetModyGizmoTm node.

I got "undefined" when I tried resetModyGizmoTm nodes whichClass:Slice center:off

What am I missing?

Kind regards
Haider
www.haider.se

barigazy's picture

...

My fault. When I write the code I often change vars names.
So when you want to execute fn use

resetModyGizmoTm selection whichClass:Slice center:off

bga

Haider of Sweden's picture

.

Thanks, it works now
I learned where to check the class names and found out that slice class name is SliceModifier and not Slice ;-)

I did some tests on the FFD.
If I modify the control points, and fiddle with the Set Volume, resetModyGizmoTm will reset everything, not only the Lattice position but also the shape.
Why is that?

Next step:
I am thinking that it might be complicated to add support for new items all the time. So is it possible to make the script work on the _selected_ sub-selection instead?

Next step2:
EPoly Slice: I would like to see gizmo controllers for that too. Should I post a new separate thread for that, or do you think that it is possible to create a generic script that supports both EPoly slice and modifier sub-objects? It mustn't necessary be the same function. You could create a script with multiple functions, where one function is for controlling the one gizmo type, and another function for the other function type.
In the end and from a user-friendly point of view, they are all the "same type of things".

Kind regards
Haider
www.haider.se

barigazy's picture

...

@Next step:
I am thinking that it might be complicated to add support for new items all the time. So is it possible to make the script work on the _selected_ sub-selection instead?

It's easier this way just say what you want more.

bga

Haider of Sweden's picture

.

Wow, this is so much fun!

Reset Mody Gizmo

because of this
resetLattice mody
 
....
 
It's easier this way just say what you want more

All right. I will gather an amount of useful cases where users might want to alter the gizmos, _which_ gizmos and how. I will suggest a UI that allows different things instead of all things in one, eg center, reset scale, reset rotate and so on.
So I'll get back to you, but first I need to understand some things:

1. does maxscript allow a UI that shows in _realtime_ (without need to refresh) what modifier is active and that shows "not supported" if the type of modifier is not supported yet? Currently we have three supported modifiers; UVMap, Slice and FFD. For now, a simple UI will do fine for the sake of testing.

2. I still dont understand the reason why center:on/off behaves like it does.
I understand "nodes.objecttransform nodes.center" (the object's own center point), but what is "translate (matrix3 1)"?

EPoly SlicePlane

I am not going to call this headline "slice plane resetter", becuase we're going to develop it to be more than just a resetter ;)

resetEPM_SlicePlane()

Seems not to work? The viewport flashes shortly, it jumps to the create-tab and I get the output "undefined"

Meanwhile: Is it possible to normal align the EPoly SlicePlane?

Kind regards
Haider
www.haider.se

barigazy's picture

...

@1. does maxscript allow a UI that shows in _realtime_ (without need to refresh) what modifier is active and that shows "not supported" if the type of modifier is not supported yet?
Yep it supports that but I not have time to create that behavior for dialog.

@Currently we have three supported modifiers; UVMap, Slice and FFD. For now, a simple UI will do fine for the sake of testing.
At least you can create one. It's not difficult. Open maxscript help document and
you can find meny examples how to do that.

@2. I still dont understand the reason why center:on/off behaves like it does.
I understand "nodes.objecttransform nodes.center" (the object's own center point), but what is "translate (matrix3 1)"?

Neither do I. :). Just kidding. When you assigne modifier you will see that some of theses are created at center and some at pivot position. You need to know which modifiers have different start position. Also if base object transform is changed then it also affects the modifier position.

bga

Comment viewing options

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