Notifications
Clear all

[Closed] Max SDK – Updating control in dialog

Probably something I missed, but as a weekend-developer trying to handle something above his own abilities, I got stuck

I’m writing this Vray camera and I created a command panel dialog containing a bunch of typical controls (spinners, checkboxes, buttons). All good.

A few of them are TYPE_BIMAPBUTTONS. They work, but I can’t figure out how to update the map name once the selection is made.

Example. User clicks on the button, selects a file, and once the file selection dialog is closed, the button does not show the bitmap name.
Switch to another tab in the command panel, and then back, and it’s there.

How can I force the button text update?

Rob

7 Replies

There might also be other ways of dealing with it, as you say it looks fine once you switch back\forth, so maybe just a ‘refresh’ call to the GUI is needed?

It’s a bit hard to say without seeing your code
, but I’m assuming you are storing the reference into a parameterblock, and then plug that into the button?

Or you have to set the button text after the user has picked the file, I do not have specific code for you right now, but I have done the same type of thing with other controllers.

What I did was to use ‘win32’ type functions to set the text on the dialog item.

Typically something like this:

SendDlgItemMessage(hWnd, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)L"MYSTRING");

The above code is to send ‘MYSTRING’ into a combobox.
For buttons you can do the same by setting the button text.

There are examples of this with the SDK, the ‘rendvue’ sample project has a lot of this (in the file ‘vuedlg.cpp’.
Where they set the text of a ‘edittext’ item (path of selected file).

You have to do some digging around to find stuff like this, but once you know how then it’s much easier next time.

Thanks.

I’ve been digging for a while I’ll keep on digging with the new clues you gave me.

Source is here. It’s all open source
https://github.com/zicher3d-org/domemaster-stereo-shader

For example check the vray->source->3dsmax->vray 3.0 cameras->vraylatlongstereo

None of us (just two actually) currently has any experience with the max SDK, so if any volunteer would like to help cleaning up and fixing the code we would really welcome them

Rob

Very nice to see other open source 3dsmax developers, I too do this.
My current project is : http://bullet4max.com/

I have bookmarked your repo, and I’m now watching it, I’ll check it out this weekend, and if I can help then I’ll do so.

Thanks. The Vray version of our plugin is the only one using the Max SDK. I just would like some help to clean it up and bring the features set up to par with the other platforms.

Currently it’s using Bitmaps, but the goal is to use Texmaps.

Rob

try this…

// declare before paramblock

class VRayCamera_PBAccessor : public PBAccessor
{
	void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
	{
		VRayCamera *cam = (VRayCamera*)owner;
		IParamMap2* pmap = cam->pblock->GetMap();
		TSTR p,f,e,name;
		switch(id)
		{
			case pb_separation_map: 
			{
				if(pmap)
				{
					TSTR sepname(v.bm->bi.Name());
					SplitFilename(sepname, &p, &f, &e);
					name = f+e;
					pmap->SetText(pb_separation_map, name.data());
				}
				break;
			}
			
			default: break;
		}
	}
};

static VRayCamera_PBAccessor pb_accessor;

// change pblock definition to

pb_separation_map, _FT("separation_map"), TYPE_BITMAP, P_SHORT_LABELS, IDS_DLG_SEPMAP,
//p_default, 1.0f,
p_ui, TYPE_BITMAPBUTTON, IDC_SEPMAP,
p_accessor,		&pb_accessor,
p_tooltip, "Separation Map",
PB_END,

Works!!!

Thanks Klvnk. I suspected Accessors were the solution, I just couldn’t figure the whole thing out. Thanks a Million

I’m going to study them now. I need to fix the other camera and I want to do it with the full understanding of what’s going on

Rob

it’s an odd one though, IIRC Mtl,Texmap and Node picking buttons handle it automatically just a quirk of bitmap buttons