C++ Importer Weirdness

Discussions concerning programming of SOFTIMAGE©
Post Reply
User avatar
Dude
Posts: 4
Joined: 27 Apr 2013, 23:07

C++ Importer Weirdness

Post by Dude » 03 Jan 2020, 19:07

I can't for the life of me figure out why Softimage is putting that [c] on the end of my importer name.
It's going to drive me crazy. 8-}

Image

User avatar
rray
Moderator
Posts: 1775
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: C++ Importer Weirdness

Post by rray » 07 Jan 2020, 22:14

Sorry! A few replies from the last few days have been lost because we had to use a 3 day old backup!

I think the [c] means compiled(??)
softimage resources section updated Jan 5th 2024

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: C++ Importer Weirdness

Post by Hirazi Blue » 08 Jan 2020, 11:01

No, I believe luceric posted the answer and IIRC the "[c]" denotes that the plugin has been loaded from a custom plugin location (set with the XSI_PLUGINS environment variable). :-\
Stay safe, sane & healthy!

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

Re: C++ Importer Weirdness

Post by luceric » 08 Jan 2020, 16:20

Hirazi Blue wrote: 08 Jan 2020, 11:01 No, I believe luceric posted the answer and IIRC the "[c]" denotes that the plugin has been loaded from a custom plugin location (set with the XSI_PLUGINS environment variable). :-\

that is the correct answer. I checked the code (after searching the doc returned nothing) :P
Last edited by luceric on 08 Jan 2020, 18:19, edited 2 times in total.

User avatar
Dude
Posts: 4
Joined: 27 Apr 2013, 23:07

Re: C++ Importer Weirdness

Post by Dude » 08 Jan 2020, 16:49

OK, thanks.
I moved the dll to C:\Users\Dude\Autodesk\Softimage_2015_SP2\Application\Plugins and it added the prefix U
"U" from "User Root" I presume.
Then I moved it to C:\Program Files\Autodesk\Softimage 2015 SP2\Application\Plugins and no prefix or postfix.
So, yeah, it's all making sense.
Next I'm going to try making an xsiaddon.
I'm using Softimage to make the transition from Python to C++.
Plus, you know, nostalgia. >-)
Python just isn't cutting it for modern game characters, i.e., 200,000 points, 1500 joints, up to 8 weights per point. •(_)•

User avatar
rray
Moderator
Posts: 1775
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: C++ Importer Weirdness

Post by rray » 11 Jan 2020, 23:11

Makes a lot of sense. the GeometryAccessor (export) and CMeshBuilder (import) were a few of the last things that were updated in XSI before development was stopped, they're really fast.
softimage resources section updated Jan 5th 2024

User avatar
Dude
Posts: 4
Joined: 27 Apr 2013, 23:07

Re: C++ Importer Weirdness

Post by Dude » 05 Feb 2020, 17:37

The next challenge is the UVs.
This looks like a point VS vertex issue.
The only other importer for SI I ever made was done with Python
and I had to do some squirrely stuff for the uvs.
Not sure how to handle it in c++ though.


User avatar
rray
Moderator
Posts: 1775
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: C++ Importer Weirdness

Post by rray » 05 Feb 2020, 17:50

I have some C++ importer code here where bits of it might be useful for you

https://github.com/ReinhardC/softimage/ ... ileFormats

the OBJ_Import.cpp does something with UVs for example
softimage resources section updated Jan 5th 2024

User avatar
Dude
Posts: 4
Joined: 27 Apr 2013, 23:07

Re: C++ Importer Weirdness

Post by Dude » 06 Feb 2020, 15:11

It turns out I was setting the UVs the same way as you.
I briefly checked out the Wavefront format and it looks like it stores UVs the way Softimage wants to use them......I think.
So I used the face indices to take them from the point-centric way they're stored in the file to a vertex-centric format.

Code: Select all

vector<float> UV_Test;
	UV_Test.reserve(faceCount2);
	for (int t = 0; t < faces.size(); ++t)
	{
		int vertex_id = faces[t];
		float u = UVs9[vertex_id].GetX();
		float v = UVs9[vertex_id].GetY();
		UV_Test.push_back(u);
		UV_Test.push_back(v);
		UV_Test.push_back(0.0);
	}
	
	if (uv_count > 0)
	{
		XSI::ClusterProperty uvs_0 = cpBuilder.AddUV();
		uvs_0.SetValues(&UV_Test[0], UV_Test.size() / 3);
	}
And then......
I realized I needed to change the vertex groups into poly groups/clusters for the materials.
(not needed for Blender)
So,.....

Code: Select all

	// material clusters
	int c2 = 0;
	for (auto g: vertexGroups)
	{
		int p_start  = g.start;
		int p_stop  = g.stop;
		int p_size  = g.size;
		XSI::CLongArray p_range;
		XSI::CTriangleRefArray triarray = mesh.GetTriangles();
		int cb = 0;
		for (int v = 0; v < triarray.GetCount(); ++v)
		{
			Vector3_I pf = faces_test[v];
			XSI::Triangle tri = triarray.GetItem(v);
			long this_tri = tri.GetPolygonIndex();
			if (pf.x >= p_start && pf.x < p_stop && pf.y >= p_start && pf.y < p_stop && pf.z >= p_start && pf.z < p_stop)
			{
				p_range.Add(this_tri);
				++cb;
			}
		}
		
		XSI::CString pee(c2);
		XSI::CString poo = "mat_" + pee;
		XSI::Cluster myCls;
		mesh.AddCluster(XSI::siPolygonCluster, poo, p_range, myCls);
		++c2;
	}
Fun times. :ymsick:
Pretty picture: https://minstryofgravy.tumblr.com/

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests