Notifications
Clear all

[Closed] 3ds Max 2014 design SDK BitArray issue

Hello.
I’m struggling with one strange issue with bitarray values in my dlx.

I released a public script with extension and user with 2014 Design told me that max crashes every time when he using my script. I tested this script and dlx many times in 2013, 2014, 2016, 2017, 2018, 2019, 2020. All my tests was OK.
So I’ve installed fresh 2014 Design and dlx crashed max.

I did some investigation and it was obvious that 2014 Design has some Bitarray values issues.
Here is my simplified test function that returns bitarray as array.

Value* bitarrayTest_cf(Value** arg_list, int count) {
	check_arg_count_with_keys(bitarrayTest, 1, count);

	BitArray faces = arg_list[0]->to_bitarray();
	int numf = faces.GetSize();
	
    one_typed_value_local(Array *arr);
	vl.arr = new Array(numf);
	for (int i = 0; i < numf; ++i) {
		if (!faces[i])
			continue;
		vl.arr->append(new Integer(i));
	}
	return_value(vl.arr);
}

In all max versions that I have installed (2013, 2016-2019) this function returns bits as it should.
If I run bitarrayTest #{50…70} it returns #(49 … 69) Array. No errors.

But when I run same command in 2014 Design, function returns different results and non of them is correct:
#(68)
#(68, 69)
#(64, 67, 69)
#()

I understand that this 3dsMax is outdated, but I’ve made this script for 2013-2020 and only 2014 Design has this flaw (at least for now).

Am I doing something wrong with Bitarrays?
Is there any way to fix it?

5 Replies

double check that you are building the plugin against the correct max libraries for design and the correct visual studio runtimes. other than that nothing stands out in your code and I don’t remember coming across any mention of differences between Design & max regarding bitarrays.

But 2014 (not design) worked without issues. Strange.
Anyway, does VS studio version matter? I compile in 2015.

are you sure you build it for 64bits version? I don’t have 2014 Design but maybe it still supports 32bits (and it’s default).

I checked now.
3ds Max Design 2014 x64. SDK is also for x64.

I ignored VS toolset recomendations so I will try to install old toolset. I hope this will fix my problem.

Today I installed VS Studio 2010, and recompiled dlx with v100 Platform Toolset.
Also I reinstalled fresh 2014 SDK. By the way there is no 32bt version. 2013 was the last 32bit ver.
And no luck, still wrong results.

I installed 2014 Classic and checked this function myself (my friend did that before) and I saw exactly the same issue. But 2013 is OK.

UPD.
Turns out it was related to wrong VS Studio project settings.
Add /opt:lbr
Add WIN64 in preprocessor
Enable Mutli-processor compilation

I’m far far away from being an expert in this
Thank you for your attention.