New NURBS tools

User avatar
trueBlue
Captain
Posts: 5213
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: New NURBS tools

Post by trueBlue »

Thanks!
This works but not from Scripts/Commands
Defined Attributes do not work
tS7 imports the script without the Command string attribute

I do notice the DefaultLibScanner script imports with defined attributes but not sure if it even works
DefaultScanner.png
DefaultScanner.png (6.33 KiB) Viewed 2494 times
It is different, it uses

Code: Select all

function Execute(ret)
{
nodeName = ret.Param('Node Name');
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: New NURBS tools

Post by clintonman »

trueBlue wrote: 11 Jan 2021, 18:28 Thanks!
This works but not from Scripts/Commands
Defined Attributes do not work
tS7 imports the script without the Command string attribute

I do notice the DefaultLibScanner script imports with defined attributes but not sure if it even works
DefaultScanner.png
It is different, it uses

Code: Select all

function Execute(ret)
{
nodeName = ret.Param('Node Name');
I have no idea what you're talking about.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5213
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: New NURBS tools

Post by trueBlue »

Got it to work
RestrictNURBS.xml

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<SCRIPT Name="RestrictNURBS" Type="Command" Language="ScriptObject Package/jScript language" UIName="" Description="" GUID="{A368C449-2565-4fdd-BE95-BB3BE0700FF2}">
	<SCRIPT_PARAM Name="Cmd" Type="string" Direction="In" Description="No description"/>

	<SCRIPT_CODE><![CDATA[

function Execute(ret)
{
	var CommandName = ret.Param('Cmd');

	// validate to avoid tS script selection bug
	if(!IsValidSelection(Node.Selection())) {
		return;
	}

	for (var i=0; i<Node.SelectedCount(); i++) {
		var Sel = Node.Selected(i);

		if(IsNURBS(Sel)) {
			return;
		}
	}

	eval(CommandName);

}

function IsValidSelection(selection)
{
	if(!selection) return false;

	var reWhiteSpace = /^\s/; // whitespace in first character position for cleaning selection text

	var selectionArray = selection.split(";");

	for(var i = 0; i < selectionArray.length; i++) {
		var selClean = selectionArray[i].replace(reWhiteSpace, "");

		if(!Node.Exists(selClean)) {
			return false;
		}
	}

	return true;
}

function IsNURBS(curNode)
{
	var nurbsNode = curNode;

	if(Node.ConExists(curNode, "Matrix"))
		nurbsNode = Node.Owner(curNode);

	if(Node.ConExists(nurbsNode, "isaCurve")) {
		return true;
	}

	if(Node.Exists(nurbsNode + "/CP to patch CP")) {
		return true;
	}

	return false
}
	]]></SCRIPT_CODE>
</SCRIPT>
Simplify Mesh toolbar command

Code: Select all

Node.Value("Scripts/Commands/RestrictNURBS", "Cmd") = "MeshModifiers.SimplifyMesh('')";Activity.Run("Scripts/Commands/RestrictNURBS");
Note to self: Is it possible to add a boolean attribute using xml version="1.0" encoding="utf-8" ?
<SCRIPT_PARAM Name="Active" Type="boolean" Direction="In" Description="No description"/>
User avatar
trueBlue
Captain
Posts: 5213
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: New NURBS tools

Post by trueBlue »

clintonman wrote: 11 Jan 2021, 05:57 Are you also planning to put restrictions on all the other tools too? I see many that will probably not work properly with nurbs.
Skeleton tools
Paint a material on a curve, or the control meshes
Hair tool on cp meshes.
SDS tool
any editing tool that would change the mesh
several of the custom tools
etc.
So far I have fixed these toolbar commands for the Navigation toolbar
Simplify Mesh
Build Normalmap
ChangeSSLevel(1)
ChangeSSLevel(-1)
Reset SDS
Heal Vertices
Scissors
PE Poly draw
PE Edge draw
PE Vertex draw
Sub Divide
Smooth Divide
Hair Length
Hair Blowdryer
Hair Softness
Hair Direction
Hair Density
Add Morph
Paint Face

Material Editor
D3D & VRay Paint Face

I do not see anything else that causes problems for Patches nor Curves
If I am missing something, give me steps and what to look for

Are you going to update the NURBStoCPMeshSelection script?
With the trueSpace selection bug fix
It gives an error if you use it after a Rectangle Select!!!
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: New NURBS tools

Post by clintonman »

trueBlue wrote: 11 Jan 2021, 23:20 ...
Are you going to update the NURBStoCPMeshSelection script?
With the trueSpace selection bug fix
It gives an error if you use it after a Rectangle Select!!!
Eventually, but the problem here is in the rsx widget plugin returning a trailing semicolon.
The quick fix is to add this after the "sel =" line and before your "not Zoom" line, about line 33 of RectSelect/data
This will remove the trailing semicolon returned by the widget code.

Code: Select all

	if(sel.length > 0) {
		sel = sel.substring(0, sel.length - 1);
	}
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5213
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: New NURBS tools

Post by trueBlue »

Awesome!!! :D
Adding...
Activity.Run("Scripts/CustomCommands/NURBSScripts/NURBSUtilities/NURBStoCPMeshSelection")
makes it perfecto! :mrgreen:
User avatar
trueBlue
Captain
Posts: 5213
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: New NURBS tools

Post by trueBlue »

trueBlue wrote: 11 Jan 2021, 23:20
clintonman wrote: 11 Jan 2021, 05:57 Are you also planning to put restrictions on all the other tools too? I see many that will probably not work properly with nurbs.
Skeleton tools
Paint a material on a curve, or the control meshes
Hair tool on cp meshes.
SDS tool
any editing tool that would change the mesh
several of the custom tools
etc.
So far I have fixed these toolbar commands for the Navigation toolbar
Simplify Mesh
Build Normalmap
ChangeSSLevel(1)
ChangeSSLevel(-1)
Reset SDS
Heal Vertices
Scissors
PE Poly draw
PE Edge draw
PE Vertex draw
Sub Divide
Smooth Divide
Hair Length
Hair Blowdryer
Hair Softness
Hair Direction
Hair Density
Add Morph
Paint Face

Material Editor
D3D & VRay Paint Face

I do not see anything else that causes problems for Patches nor Curves
If I am missing something, give me steps and what to look for
This is not working for Shortcuts
As an example for Add SDS in PE mode
Node.Value("Scripts/Commands/RestrictNURBS", "Cmd") = "MeshModifiers.ChangeSSLevel(1)";Activity.Run("Scripts/Commands/RestrictNURBS");
Best I can tell, the first part using Node.Value does not work for Shortcuts
Activity.Run does work for Shortcuts
Assigning the shortcut does not work either
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: New NURBS tools

Post by clintonman »

trueBlue wrote: 14 Jan 2021, 12:32 ...
This is not working for Shortcuts
As an example for Add SDS in PE mode
Node.Value("Scripts/Commands/RestrictNURBS", "Cmd") = "MeshModifiers.ChangeSSLevel(1)";Activity.Run("Scripts/Commands/RestrictNURBS");
Best I can tell, the first part using Node.Value does not work for Shortcuts
Activity.Run does work for Shortcuts
Assigning the shortcut does not work either
Too bad, I'll see if I can find another way, outside of adding 20 new command nodes.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5213
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: New NURBS tools

Post by trueBlue »

Cool :bananathumb:
Really late in the game but I am wondering if you would have added a NURBS Attribute out of the controlPointMesh and LODMesh to the Patches and Curves, if it would have been a lot easier for identification.
NURBS.png
NURBS.png (9.77 KiB) Viewed 2464 times
User avatar
clintonman
Captain
Posts: 5428
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: New NURBS tools

Post by clintonman »

trueBlue wrote: 14 Jan 2021, 15:43 Cool :bananathumb:
Really late in the game but I am wondering if you would have added a NURBS Attribute out of the controlPointMesh and LODMesh to the Patches and Curves, if it would have been a lot easier for identification.
NURBS.png
Probably, too late now.
Clinton Reese

http://clintons3d.com
Post Reply