help with last similar operation in stack

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

help with last similar operation in stack

Post by kowy » 30 Sep 2021, 13:33

here's a script
GetPrimLattice(null, null, null, null, null);
SetValue("lattice.lattice.subdivx", 2, null);
SetValue("lattice.lattice.subdivy", 2, null);
SetValue("lattice.lattice.subdivz", 2, null);

it works fine on first lattice operations, when added second, it will change subd only for first instance of lattice, how can I change for last operation done ? SetValue("lattice1.lattice.subdivx", 2, null); SetValue("lattice2.lattice.subdivx", 2, null); so on
~ similar to other operations like bevel

User avatar
Kolya
Posts: 39
Joined: 03 Oct 2017, 19:17

Re: help with last similar operation in stack

Post by Kolya » 30 Sep 2021, 15:38

You need to use a variable(lat) to store a reference to created lattice and then use it with SetValue

var lat = GetPrimLattice(null, null, null, null, null);
SetValue(lat +".lattice.subdivx", 2, null);
SetValue(lat +".lattice.subdivy", 2, null);
SetValue(lat +".lattice.subdivz", 2, null);

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 30 Sep 2021, 15:56

thank you !!!
and how can i do for bevel ?
Application.ApplyTopoOp("BevelComponent", "cube1.edge[3]", "siUnspecified", "siPersistentOperation", "")
Application.SetValue("cube.polymsh.bevelop.nbsubdivs", 1, "")
Application.SetValue("cube.polymsh.bevelop.roundingextrapolation", 1.5, "")

that should be parimeter/safe bevel -> equal from both sides

User avatar
Kolya
Posts: 39
Joined: 03 Oct 2017, 19:17

Re: help with last similar operation in stack

Post by Kolya » 30 Sep 2021, 16:26

//JScript
var ops = ApplyTopoOp("BevelComponent");
for(var i=0; i<ops.Count; i++){
SetValue(ops(i) +".nbsubdivs", 1);
SetValue(ops(i) +".roundingextrapolation", 1.5);

//using these values may give you better result, but it still won't be perfect
//SetValue(ops(i) +".nbsubdivs", 1);
//SetValue(ops(i) +".tesselatesharpness", 1.7425434494519254);
//SetValue(ops(i) +".roundingextrapolation", 0.4428090415820636);

}
InspectObj(ops);

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 30 Sep 2021, 17:09

thanks * 2 )))) -> already saved a lot of time
and last one
select hard edges of extruded polygons
the way I do now
select adjustments (edge/polygon -> depending on task) -> rc tools -> SetValue("preferences.Custom Filters (RCTools).EdgeSharp_apply", true, null);
and every time i have to open rc popup and press "keep" button

User avatar
Kolya
Posts: 39
Joined: 03 Oct 2017, 19:17

Re: help with last similar operation in stack

Post by Kolya » 30 Sep 2021, 18:28

If I understood you correctly, this should do

Code: Select all

//store RCTools edge filter settings
var rc_Length = GetValue("preferences.Custom Filters (RCTools).Length_apply");
var rc_TotalAdjE = GetValue("preferences.Custom Filters (RCTools).TotalAdjE_apply");
var rc_EdgeAdjP = GetValue("preferences.Custom Filters (RCTools).EdgeAdjP_apply");
var rc_EdgeOrientation = GetValue("preferences.Custom Filters (RCTools).EdgeOrientation_apply");
var rc_EdgeAngle = GetValue("preferences.Custom Filters (RCTools).EdgeAngle_apply");
var rc_EdgeSharp = GetValue("preferences.Custom Filters (RCTools).EdgeSharp_apply");
var rc_EdgeUVBorder = GetValue("preferences.Custom Filters (RCTools).EdgeUVBorder_apply");
var rc_RandomEdge = GetValue("preferences.Custom Filters (RCTools).RandomEdge_apply");

var sel = Selection(0);
var subc = sel.SubComponent;
var ccoll = subc.ComponentCollection;
if(subc.Type == "edgeSubComponent" || subc.Type == "polySubComponent"){
	var nEdges = ccoll.NeighborEdges(1);
	if (subc.Type == "polySubComponent")
		var nEdges = nEdges.NeighborEdges(1);
		
	SetValue("preferences.Custom Filters (RCTools).Length_apply", false);
	SetValue("preferences.Custom Filters (RCTools).TotalAdjE_apply", false);
	SetValue("preferences.Custom Filters (RCTools).EdgeAdjP_apply", false);
	SetValue("preferences.Custom Filters (RCTools).EdgeOrientation_apply", false);
	SetValue("preferences.Custom Filters (RCTools).EdgeAngle_apply", false);
	SetValue("preferences.Custom Filters (RCTools).EdgeSharp_apply", true);
	SetValue("preferences.Custom Filters (RCTools).EdgeUVBorder_apply", false);
	SetValue("preferences.Custom Filters (RCTools).RandomEdge_apply", false);
	
	SelectGeometryComponents(nEdges);
	SelectObj(Filters("rcCustomEdgeFilter").Subset(Selection));
	
	// restore RCTools edge filter settings
	SetValue("preferences.Custom Filters (RCTools).Length_apply", rc_Length);
	SetValue("preferences.Custom Filters (RCTools).TotalAdjE_apply", rc_TotalAdjE);
	SetValue("preferences.Custom Filters (RCTools).EdgeAdjP_apply", rc_EdgeAdjP);
	SetValue("preferences.Custom Filters (RCTools).EdgeOrientation_apply", rc_EdgeOrientation);
	SetValue("preferences.Custom Filters (RCTools).EdgeAngle_apply", rc_EdgeAngle);
	SetValue("preferences.Custom Filters (RCTools).EdgeSharp_apply", rc_EdgeSharp);
	SetValue("preferences.Custom Filters (RCTools).EdgeUVBorder_apply", rc_EdgeUVBorder);
	SetValue("preferences.Custom Filters (RCTools).RandomEdge_apply", rc_RandomEdge);
}

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 30 Sep 2021, 19:45

u made my day ! thank you !!!
all correct sir !

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 12 Oct 2021, 14:22

Ohayo !
Have some questions !
1. I'm using knife tool to delete sections above or below, later Ffill gaps - that's for sharing that addon !
is it possible to script deleting ? I haven't found a way(1 button/or keystroke) to view last modifier in stack. They way i'm doing now -> knife -> f3 -> expand -> enter the modifier or knife -> selection button -> enter modifier, knife - explorer -> expand enter modifier
perfect will be similar to blender approach -> bisect
2. after capping border edges - for cleanup i have to remake topology, easiest way is to select and connect. xsi has only chunky connect 2 points with a null, alternative's i've found XCutEdge - witch often glitches and needs to freeze model
a script for connecting 2 selected points
3. How to view last modifier in stack ? keystroke ? example knife doesn't open proprieties after executing the operation

User avatar
Kolya
Posts: 39
Joined: 03 Oct 2017, 19:17

Re: help with last similar operation in stack

Post by Kolya » 12 Oct 2021, 20:09

Hello, I've packed that into a simple plugin: https://drive.google.com/file/d/1jd64Ad ... BWMwS/view
There are 5 commands which you can bind to a hotkey : InspectLastOp, SliceOp_DeleteAbove, SliceOp_DeleteBelow, SliceOp_DeleteAndFillAbove, SliceOp_DeleteAndFillBelow

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 12 Oct 2021, 21:17

thanks ! is it possible to add to selection cutting loop ?
after some more digging it was an hotkey for last operation in stack -> ctrl + end )

User avatar
Kolya
Posts: 39
Joined: 03 Oct 2017, 19:17

Re: help with last similar operation in stack

Post by Kolya » 13 Oct 2021, 17:27

I added command SliceOp_SelectEdges to select edge loops.
build-in command for inspecting last operator works only in object mode,
InspectLastOp works even when you're in component selection mode and nothing selected.
https://drive.google.com/file/d/1bda04r ... sp=sharing

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 14 Oct 2021, 20:15

Ohayo
I'm confused how I should run build-in command
earlier it was with register & i could find costum commands -> in_reg - new commands records
but this one is not registered
trying SliceOpTools(); - error
SliceOp_SelectEdges - not registered

User avatar
Kolya
Posts: 39
Joined: 03 Oct 2017, 19:17

Re: help with last similar operation in stack

Post by Kolya » 15 Oct 2021, 09:51

Hello, SliceOpTools() is an internal function that is only being used inside of the plugin by registered within function XSILoadPlugin() commands.
Registered commands, can be run like this: SliceOp_SelectEdges();

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 15 Oct 2021, 20:34

still confused
running knife tool
SliceOp_DeleteAbove_Execute - scripted hotkey
alt +4 (script editor)-> SliceOp_SelectEdges(); nothing

User avatar
Kolya
Posts: 39
Joined: 03 Oct 2017, 19:17

Re: help with last similar operation in stack

Post by Kolya » 16 Oct 2021, 10:22

After placing the file to C:\Users\user_name\Autodesk\Softimage_version\Application\Plugins
Open Plugin Manager to see if it's loaded.
Then you can try to invoke the commands from there

kowy
Posts: 47
Joined: 01 Jun 2020, 16:30

Re: help with last similar operation in stack

Post by kowy » 16 Oct 2021, 14:35

thanks ! was one of my mistakes copy pasted script & haven't copied all, on last strokes it was SliceOp_SelectEdges() ! thanks !

Post Reply

Who is online

Users browsing this forum: No registered users and 82 guests