C++ custom tool SDK programming tip

Discussions concerning programming of SOFTIMAGE©
Ahmidou
Posts: 106
Joined: 04 Jan 2010, 14:00

Re: C++ custom tool SDK programming tip

Post by Ahmidou » 28 Jul 2012, 11:31

Nice Steven! too bad I didn't found the time to finish mine... Anyway as piotrek pointed it was slow with dense meshes and your's should be more effective :)

User avatar
origin
Posts: 619
Joined: 09 Jun 2009, 11:59
Location: warsaw

Re: C++ custom tool SDK programming tip

Post by origin » 28 Jul 2012, 17:17

Steven what about cmake tutorial you mentioned some time ago on mailinglist ;) :ympray:

scaron
Posts: 119
Joined: 08 Jul 2009, 05:16

Re: C++ custom tool SDK programming tip

Post by scaron » 29 Jul 2012, 10:10

i made the first part a while ago, just not the second part which is needed for new projects using cmake. feel free to ask my any questions though... maybe i can turn this new project into a tutorial on cmake also :)

Last edited by scaron on 01 Aug 2012, 01:08, edited 1 time in total.

luceric
Posts: 1251
Joined: 22 Jun 2009, 00:08

Re: C++ custom tool SDK programming tip

Post by luceric » 30 Jul 2012, 02:47

just wanted to note that you can talk to the developer of the tool SDK (and the tweak and manipulators), Brent, by posting on the XSI mailing list.

scaron
Posts: 119
Joined: 08 Jul 2009, 05:16

Re: C++ custom tool SDK programming tip

Post by scaron » 30 Jul 2012, 03:06

i figured brent is too busy working on maya ;) thanks for the reminder...

s

scaron
Posts: 119
Joined: 08 Jul 2009, 05:16

Re: C++ custom tool SDK programming tip

Post by scaron » 30 Jul 2012, 09:29

here is the code...

https://github.com/caron/SimpleBrush

this basic brush looks like the built in weight paint brush, adjusting the radius with the r key works, normal alignment is still wrong. i am trying to mimic the built in weight paint brush, i havent figured out how they're doing the smooth interpolation or averaging yet. you can see it on the default sphere when you move the brush across the surface.

i am sharing for others who haven't made a brush tool yet but want to, this should could be a nice start. piotrek wont find anything new in here ;)

steven

User avatar
origin
Posts: 619
Joined: 09 Jun 2009, 11:59
Location: warsaw

Re: C++ custom tool SDK programming tip

Post by origin » 30 Jul 2012, 18:10

I have noone to learn from in my work so I welcome any piece of code with joy :)
I have a question, do you write those cmakelist.txt files by hand from scratch or you have some templates that you fill only with links to libs and cpps? Do these files work without any modifications on linux too? (i started to learn fedora...)

scaron
Posts: 119
Joined: 08 Jul 2009, 05:16

Re: C++ custom tool SDK programming tip

Post by scaron » 30 Jul 2012, 19:13

origin wrote:I have a question, do you write those cmakelist.txt files by hand from scratch or you have some templates that you fill only with links to libs and cpps? Do these files work without any modifications on linux too? (i started to learn fedora...)
i usually copy from my last one, or copy from other available projects using cmake (alembic is big ol'nasty one) but otherwise they are written by hand. this file can be source controlled easily and is included in the visual studio project so you can make edits easily. visual studio actually knows when you changed the cmakelist.txt and will auto regenerate the project with new settings.

i only have to fill out 'extra' links, at this time the FindSoftimage.cmake module (this is actually all the hard work done by alan jones) doesn't understand CustomTool plugin types but that is an easy addition and i will do so eventually so all you need to do is call 'add_softimage_tool_plugin()' and the adding of the ogl and glu libs will be taken care of automatically. also you can use globbing to collect all your source files instead of listing them by hand. http://www.cmake.org/Wiki/CMake:How_To_ ... nput_Files

these cmake files might need modification for linux, but since alan jones made them i doubt it will be much to change. this does NOT mean you can neglect to make your code cross platform. the FindSoftimage.cmake module needs to be updated as new versions of softimage come out, updating the various paths to the new version.

good luck!
s

User avatar
origin
Posts: 619
Joined: 09 Jun 2009, 11:59
Location: warsaw

Re: C++ custom tool SDK programming tip

Post by origin » 03 Aug 2012, 21:35

Thanks I migrated all my projects to cmake, simply by editing your cmakelist.txt and hand typing all the *.c* and *.h files. So no more setting up VS projects, great!
Now the only annoying thing is that I have to copy my .dll from cmake's build dir to plugin's Application/bin/... folder everytime I build project in VS. Should I manually change output directory in VS?

User avatar
origin
Posts: 619
Joined: 09 Jun 2009, 11:59
Location: warsaw

Re: C++ custom tool SDK programming tip

Post by origin » 07 Aug 2012, 08:26

OK It was just a matter of setting CMAKE_INSTALL_PATH pointing to plugin base dir. and turning on INSTALL project in Configuration Manager

Ahmidou
Posts: 106
Joined: 04 Jan 2010, 14:00

Re: C++ custom tool SDK programming tip

Post by Ahmidou » 10 May 2013, 10:40

origin wrote:Hey Ahmidou, I think SetupPointLocatorQueries is very slow when you pass -1 (all polys) argument, so its better to restrict search for particular polygons
Hi Piotrek,
I took some time to run some tests and found out that it's equivalent.
The only difference is when moving the camera, when I pass a polygon, it's slower on the first and second iteration,
then it's coming back at the same speed.

Good to know!

Cheers
A

User avatar
origin
Posts: 619
Joined: 09 Jun 2009, 11:59
Location: warsaw

Re: C++ custom tool SDK programming tip

Post by origin » 10 May 2013, 11:37

I think it's dependand whenever raycasting cache (generated with GetRaycastIntersection...) is cleared or not.
It's cleared when you lose scope of your PolygonMesh variable.
So best bet is to run SetupPoint.. in customtool's Setup function (and maybe in SelectionChange event) with PolygonMesh being global variable.
This way cache is generated only once and futher raycasts are instant.
Eg for 31 million poly raycasting with cache its realtime (no drop in fps)
The only problem is to keep this cache so It won't be cleared when you exit the tool, not sure how you would do that (it take ~10seconds to cache 31 million tri object)
I think, watching ram usage, in your LivePaint tool you're recaching also on changeview which leads to huge performance drop.
Another case in your tool is that your pointposition change, so the cache needs to regenerated every mouse drag...

scaron
Posts: 119
Joined: 08 Jul 2009, 05:16

Re: C++ custom tool SDK programming tip

Post by scaron » 16 May 2013, 03:00

as far as caching goes the Geometry class provides PutCache and GetCache...

http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_cpp/classXSI_1_1Geometry.html,topicNumber=si_cpp_classXSI_1_1Geometry_html,hash=a776317aeb4cf15a9d68074a17c38d824

but with a plugin ahmidou's where the point positions are changing constantly it might not be useful. unless the cache can be some how partially and incrementally updated. i doubt that though :)

Ahmidou
Posts: 106
Joined: 04 Jan 2010, 14:00

Re: C++ custom tool SDK programming tip

Post by Ahmidou » 16 May 2013, 08:38

I just saw the Put/GetCache yesterday, this might be usefull for a relax+shrinkwrap brush.
Anyway the tool is already faster than push or smooth + weightMap, but I'm still testing which method would be faster.
Piotrek you're right and it make sense, there is some point where rebuilding the acceleration tree become slower than the pickBuffer.
It also need to be rebuilt for the GetClosestLocationsWithinRadius which I'm forced to use every drag update...

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests