I'm in! No... waitNow would be a good time to start the "rray (re)coding community project",
to get rid of the c# (and let others do all the work! )
RCTools 4.3
Re: RCTools 4.3
You're all welcome!
softimage resources section updated Jan 5th 2024
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: RCTools 4.3
rray wrote:I'm in! No... wait
(but the initial idea was meant to be taken more or less seriously ;) )
Stay safe, sane & healthy!
Re: RCTools 4.3
source code available here. (rctools4_cs directory) Will be of assistance
softimage resources section updated Jan 5th 2024
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: RCTools 4.3
To Python? (no guarantees, obviously, that's the downside of open source... )
Stay safe, sane & healthy!
Re: RCTools 4.3
Can't tell you what would actually run the fastest (which would probably be a big decision factor) - I'll do some tests.
Python would "sort of" make sense because I'm planing to use XPOP3 (written in python) for the popup (instead of the C++ MFC version)
Python would "sort of" make sense because I'm planing to use XPOP3 (written in python) for the popup (instead of the C++ MFC version)
softimage resources section updated Jan 5th 2024
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: RCTools 4.3
I hope you decide on Python, otherwise I'd have to step down as a volunteer... ;)
Stay safe, sane & healthy!
Re: RCTools 4.3
Oh no Python performs 30 times slower than JS in my tests.
I've written a simple triangle filter
(sources python/JS/VBS below -- For testing I used a polymsh sphere, local subd refinement, Doo-Sabin, Level 4)
Python Output:
C++ test still to go...
btw (from RCTools):
C# Output:
I've written a simple triangle filter
(sources python/JS/VBS below -- For testing I used a polymsh sphere, local subd refinement, Doo-Sabin, Level 4)
Python Output:
JS Output:# Execution time : 3388.01209812 ms
VBS Output:# INFO : Execution time : 113 ms
Maybe it's the way I use the for loop in python that's wrong .. no idea' INFO : Execution Time = 93,75 ms
C++ test still to go...
btw (from RCTools):
C# Output:
// INFO : Execution time : 576 ms
Code: Select all
import win32com.client
# Import the constants
from win32com.client import constants
from time import *
null = None
false = 0
true = 1
def XSILoadPlugin( in_reg ):
in_reg.Author = "Ray"
in_reg.Name = "PyBench Plug-in"
in_reg.Major = 1
in_reg.Minor = 0
in_reg.RegisterFilter("PyBench", constants.siFilterSubComponentPolygon)
#RegistrationInsertionPoint - do not remove this line
return true
def XSIUnloadPlugin( in_reg ):
strPluginName = in_reg.Name
Application.LogMessage(str(strPluginName) + str(" has been unloaded."),constants.siVerbose)
return true
# Match callback for the PyBench custom filter.
def PyBench_Match( in_ctxt ):
Application.LogMessage("PyBench_Match called", constants.siVerbose)
# Return value indicates if the input object matches the filter criterias.
return true
# Subset callback for the PyBench custom filter.
def PyBench_Subset( in_ctxt ):
Application.LogMessage("PyBench_Subset called", constants.siVerbose)
start = clock()
items = []
coll = XSIFactory.CreateObject("XSI.Collection")
in_objs = in_ctxt.GetAttribute("Input")
for obj in in_objs:
subc = obj.SubComponent
cc = subc.ComponentCollection
for poly in cc:
if poly.Points.Count < 4:
items.append(poly.Index)
oGeo = subc.Parent3DObject.ActivePrimitive.GetGeometry2( 0, constants.siConstructionModeSecondaryShape )
coll.Add( oGeo.CreateSubComponent("poly", items) )
in_ctxt.SetAttribute("Output", coll)
end = clock()
print("Execution time : " + str(1000*(end - start)) + " ms")
return true
# Init callback for the PyBench custom filter.
def PyBench_Init( in_ctxt ):
Application.LogMessage("PyBench_Init called", constants.siVerbose)
return true
Code: Select all
function XSILoadPlugin( in_reg )
{
in_reg.Author = "Ray";
in_reg.Name = "JSBench Plug-in";
in_reg.Major = 1;
in_reg.Minor = 0;
in_reg.RegisterFilter("JSBench",siFilterSubComponentPolygon);
//RegistrationInsertionPoint - do not remove this line
return true;
}
function XSIUnloadPlugin( in_reg )
{
var strPluginName;
strPluginName = in_reg.Name;
Application.LogMessage(strPluginName + " has been unloaded.",siVerbose);
return true;
}
// Match callback for the JSBench custom filter.
function JSBench_Match( in_ctxt )
{
Application.LogMessage("JSBench_Match called",siVerbose);
// Return value indicates if the input object matches the filter criterias.
return true;
}
// Subset callback for the JSBench custom filter.
function JSBench_Subset( in_ctxt )
{
Application.LogMessage("JSBench_Subset called");
var start = new Date().getTime();
coll = new ActiveXObject("XSI.Collection");
in_objs = in_ctxt.GetAttribute("Input");
jsA = new Array();
e = new Enumerator(in_objs);
for(; !e.atEnd(); e.moveNext())
{
logmessage(e.item().type);
subc = e.item().SubComponent;
cc = subc.ComponentCollection;
e2 = new Enumerator(cc);
for(; !e2.atEnd(); e2.moveNext()) {
if(e2.item().Points.Count < 4)
jsA.push(e2.item().Index);
}
oGeo = subc.Parent3DObject.ActivePrimitive.GetGeometry(0, siConstructionMode.siConstructionModeSecondaryShape);
coll.Add( oGeo.CreateSubComponent("poly", jsA) );
}
in_ctxt.SetAttribute("Output", coll);
var end = new Date().getTime();
logmessage("Execution time : " + eval(end - start) + " ms");
// Return value indicates if a subset of the input objects matches the filter criterias.
return true;
}
// Init callback for the JSBench custom filter.
function JSBench_Init( in_ctxt )
{
Application.LogMessage("JSBench_Init called",siVerbose);
return true;
}
Code: Select all
function XSILoadPlugin( in_reg )
in_reg.Author = "Ray"
in_reg.Name = "VBBench Plug-in"
in_reg.Major = 1
in_reg.Minor = 0
in_reg.RegisterFilter "VBBench",siFilterSubComponentPolygon
'RegistrationInsertionPoint - do not remove this line
XSILoadPlugin = true
end function
function XSIUnloadPlugin( in_reg )
dim strPluginName
strPluginName = in_reg.Name
Application.LogMessage strPluginName & " has been unloaded.",siVerbose
XSIUnloadPlugin = true
end function
' Match callback for the VBBench custom filter.
function VBBench_Match( in_ctxt )
Application.LogMessage "VBBench_Match called",siVerbose
' Return value indicates if the input object matches the filter criterias.
VBBench_Match = true
end function
' Subset callback for the VBBench custom filter.
function VBBench_Subset( in_ctxt )
Application.LogMessage "VBBench_Subset called",siVerbose
start = timer
set coll = CreateObject( "XSI.Collection" )
set in_objects = in_ctxt.GetAttribute( "Input" )
for each obj in in_objects
' get the edge object(s) from the subcomponent
set subc = obj.SubComponent
dim aIndices
nb_indices = 0
l_Array = subc.ElementArray
set l_Comps = subc.ComponentCollection
ReDim aIndices( ubound(l_Array) - lbound(l_Array) )
for each ply in l_Comps
if ply.Points.Count < 4 then
aIndices(nb_indices) = ply.Index
nb_indices = nb_indices + 1
end if
next
if nb_indices > 0 then
ReDim Preserve aIndices( nb_indices - 1 )
set oSubComponent = subc.Parent3DObject.activeprimitive.geometry.CreateSubComponent("poly", aIndices )
coll.Add oSubComponent
end if
next
in_ctxt.SetAttribute "Output", coll
endt = timer
LogMessage "Execution Time = " & 1000*(endt-start) & " ms"
VBBench_Subset = coll.Count > 04
end function
' Init callback for the VBBench custom filter.
function VBBench_Init( in_ctxt )
Application.LogMessage "VBBench_Init called",siVerbose
VBBench_Init = true
end function
softimage resources section updated Jan 5th 2024
Re: RCTools 4.3
Well ok I looks like I won't be able to get python to perform any faster with this - I guess I'm going to do aport to VBS then - seems not like too much work except changing some syntax.
VBS seems the closest to Softimage's internal architecture. JScript probably is, too (COM Version) except the arrays are different and some translation there has to be done which makes it a little slower than VBS.
VBS seems the closest to Softimage's internal architecture. JScript probably is, too (COM Version) except the arrays are different and some translation there has to be done which makes it a little slower than VBS.
softimage resources section updated Jan 5th 2024
Re: RCTools 4.3
Python's loops seems to be lot slower in Softimage than the others...
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: RCTools 4.3
Moderator edit: I moved the announcement for RCTools 4.4 to a new thread
Stay safe, sane & healthy!
Re: RCTools 4.3
ROFLrray wrote:Oh no Python performs 30 times slower than JS in my tests.
I've written a simple triangle filter
(sources python/JS/VBS below -- For testing I used a polymsh sphere, local subd refinement, Doo-Sabin, Level 4)
Python Output:# Execution time : 3388.01209812 ms
Python is not slow, it's fucking Microsoft COM converting list to COM VARIANT so long for some reason (remove list conversion at the end and you'll see):
Code: Select all
import win32com.client
from win32com.client import constants as c
from time import *
start = clock()
coll = XSIFactory.CreateObject("XSI.Collection")
obj = Application.Selection(0)
subc = obj.SubComponent
cc = subc.ComponentCollection
items = (poly.Index for poly in cc if poly.Points.Count < 4)
end = clock()
print("Execution time : " + str(1000*(end - start)) + " ms")
oGeo = subc.Parent3DObject.ActivePrimitive.GetGeometry2( 0, c.siConstructionModeSecondaryShape )
coll.Add( oGeo.CreateSubComponent("poly", list(items)) )
Who is online
Users browsing this forum: No registered users and 56 guests