Skip to content

Build issue: no QmaxMainWindow::raiseDockWidget SDK 2027 #48

Description

@charlesfleche

Describe the bug

SettingManagement.cpp calls QmaxMainWindow::raiseDockWidget. However, this method is absent from the latest Max 2027 SDK.

Maybe the a newer SDK is used internally at Autodesk and is not released yet ?

Meanwhile I've been able to build by patching SettingsManagement.h like this:

// QmaxMainWindow::raiseDockWidget() was introduced in a newer 3ds Max 2027 SDK
// (alongside the USD Path Editor). Older 2027 SDK builds do not declare it, even
// though they report the same MAX_RELEASE (R29), so a version-number guard cannot
// tell the two apart. Detect the method at compile time instead: when present, use
// it to bring a tabbed dock widget's tab to the front; when absent, fall back to
// the plain QWidget::raise() that already follows each call site (visibility is
// unaffected). This keeps a single source tree building against both SDK builds.
template <typename MainWindow, typename DockWidget, typename = void>
struct HasRaiseDockWidget : std::false_type
{
};

template <typename MainWindow, typename DockWidget>
struct HasRaiseDockWidget<
    MainWindow,
    DockWidget,
    std::void_t<decltype(std::declval<MainWindow*>()->raiseDockWidget(std::declval<DockWidget*>()))>>
    : std::true_type
{
};

template <typename MainWindow, typename DockWidget>
std::enable_if_t<HasRaiseDockWidget<MainWindow, DockWidget>::value>
RaiseDockWidgetIfSupported(MainWindow* mainWindow, DockWidget* dockWidget)
{
    mainWindow->raiseDockWidget(dockWidget);
}

template <typename MainWindow, typename DockWidget>
std::enable_if_t<!HasRaiseDockWidget<MainWindow, DockWidget>::value>
RaiseDockWidgetIfSupported(MainWindow*, DockWidget*)
{
    // No-op: the caller invokes dockWidget->raise()/show() immediately after.
}

This is the current content of the 3ds Max SDK QmaxMainWindow.h

//-----------------------------------------------------------------------------
// Copyright 2016 Autodesk, Inc.  All rights reserved.
//
//  Use of this software is subject to the terms of the Autodesk license 
//  agreement provided at the time of installation or download, or which 
//  otherwise accompanies this software in either electronic or hard copy form.
//-----------------------------------------------------------------------------


#pragma once

#include "../CoreExport.h"

#ifndef MAX_COMPONENTS
#include "../BuildWarnings.h"
#endif

#pragma warning(push)
#pragma warning(disable: 4251 4275 4512 4800)
#include <QtWidgets/QMainWindow>
#pragma warning(pop)

// forward declarations
class ICustToolbar;

namespace MaxSDK {;

// forward declarations
class QmaxDockingWinHost;
class QmaxMainWindowPrivate;

//-----------------------------------------------------------------------------
// class QmaxMainWindow
//-----------------------------------------------------------------------------
/** \brief This class is used by 3ds Max for its docking UI and should be used
* as replacement for the standard QMainWindow.
*/
class CoreExport QmaxMainWindow : public QMainWindow
{
	Q_OBJECT

	/** \brief Determines whether the docked toolbars and dockwidgets can be 
	* moved around and/or made floating.
	* \see dockingLocked(), setDockingLocked(), dockingLockedChanged() */
	Q_PROPERTY( bool dockingLocked READ dockingLocked WRITE setDockingLocked )

public:

	// common docking flags
	enum QmaxDockFlag
	{
		DontSaveCUIContent = 0x1,
		SystemWindow = 0x2,
		HideInVisiblityMenu = 0x4, // hides toggle visibility menu entry in main window popup
		ShowInExpertMode = 0x8,
		DestroyOnCUIChange = 0x10, // indicates if a dockwidget should be destroyed when a new CUI scheme is loaded, only makes sense for content that can change dynamically in different workspaces
		NoDockFlags = 0
	};

	Q_DECLARE_FLAGS( QmaxDockFlags, QmaxDockFlag )

	enum QmaxDockType
	{
		Window,
		Toolbar,
		Menu
	};

	explicit QmaxMainWindow( QWidget* parent = nullptr, Qt::WindowFlags flags = {} ); 
	virtual ~QmaxMainWindow() override;

	/** \brief Loads a docking layout from a specified file.
	* \param fileName The full path to a docking layout file that should be loaded.
	* \see saveLayout() */
	void loadLayout( const QString& fileName );

	/** \brief Saves the current docking layout to a specified file.
	* \param fileName The full path to the docking layout file that should be saved.
	* \see loadLayout() */
	void saveLayout( const QString& fileName ) const;
	
	/** \brief Returns the file extension for a 3ds Max docking layout file.
	* \see loadLayout(), saveLayout() */
	static QString layoutFileExtension() { return ".layout"; }

	/** \brief Returns a list with the toolbars attached to this main window.
	* \see getDockWidgets() */
	QList< QToolBar* > getToolBars() const;

	/** \brief Returns a list with the dock widgets attached to this main window.
	* \see getToolBars() */
	QList< QDockWidget* > getDockWidgets() const;

	/** \brief Determines whether the docked toolbars and dockwidgets can be 
	* moved around.
	* 
	* The basic idea of having the docking locked mode is to prevent all docked 
	* toolbars and dockwidgets to be moved or made floating. Already floating 
	* toolbars and dockwidgets can be moved around but not be docked back into 
	* the main window. 
	* 
	* Note that docking locked does not prevent the user from resize the UI. */
	bool dockingLocked() const;

	// ---------------------------------------------------------------------------------
	// max docking helpers 
		
	/** \brief Sets the 3ds Max dock type on a QToolBar or QDockWidget.
	* \param[in] widget	The QToolBar or QDockWidget on which the dock type should be set.
	* \param[in] dockType The dock type of the actual docking content.
	* \see maxDockType() */
	static void setMaxDockType( QWidget* widget, QmaxDockType dockType );

	/** \brief Returns the 3ds Max dock type for a QToolBar or QDockWidget.
	* \param[in] widget	The QToolBar or QDockWidget for which the dock type should be returned.
	* \see setMaxDockType() */
	static QmaxDockType maxDockType( const QWidget* widget );

	/** \brief Sets the 3ds Max specific dock flags on a QToolBar or QDockWidget.
	* \param[in] widget	The QToolBar or QDockWidget on which the dock flags should be set.
	* \param[in] dockFlags The 3ds Max specific dock flags.
	* \see maxDockFlags(), addMaxDockFlags() */
	static void setMaxDockFlags( QWidget* widget, QmaxDockFlags dockFlags );

	/** \brief Returns the 3ds Max specific dock flags for a QToolBar or QDockWidget.
	* \param[in] widget	The QToolBar or QDockWidget for which the dock flags should be returned.
	* \see setMaxDockFlags(), addMaxDockFlags() */
	static QmaxDockFlags maxDockFlags( const QWidget* widget );

	/** \brief Adds the 3ds Max specific dock flags on a QToolBar or QDockWidget.
	* \param[in] widget	The QToolBar or QDockWidget on which the dock flags should be added.
	* \param[in] dockFlags The 3ds Max specific dock flags.
	* \see maxDockFlags(), setMaxDockFlags() */
	static void addMaxDockFlags( QWidget* widget, QmaxDockFlags dockFlags ) { setMaxDockFlags( widget, maxDockFlags( widget ) | dockFlags ); }

	/** \brief Makes a docked toolbar floating at the specified screen position.
	* \param[in] toolBar The QToolBar that should float.
	* \param[in] pos The screen position at which the toolbar should float.
	* \note The toolbar needs to be added once to the main window toolbar layout, 
	* before you can't float it. */
	static void makeToolBarFloating( QToolBar* toolBar, const QPoint& pos = QPoint() );

	/** \brief Returns the toolbar area for a QToolBar.
	* \param[in] toolbar The QToolBar for which the toolbar area should be returned.
	* \see getDockWidgetArea() */
	static Qt::ToolBarArea getToolBarArea( QToolBar* toolbar );

	/** \brief Returns the docking area for a QDockWidget.
	* \param[in] dockwidget The QDockWidget for which the docking area should be returned.
	* \see getToolBarArea() */
	static Qt::DockWidgetArea getDockWidgetArea( QDockWidget* dockwidget );

	/** \brief Retrieves the QmaxDockingWinHost if the given toolbar hosts a legacy win32 control.
	* \param[in] toolbar The QToolBar for which the QmaxDockingWinHost should be retrieved.
	* \see getICustToolbar() */
	static QmaxDockingWinHost* getDockingWinHost( QToolBar* toolbar );

	/** \brief Retrieves the legacy 3ds Max toolbar if the given QToolBar hosts one.
	* \note The function calls internally GetICustToolbar( HWND ), so you need
	* to call ReleaseICustToolbar after usage.
	* \see GetICustToolbar(), ReleaseICustToolbar(), getDockingWinHost() */
	static ICustToolbar* getICustToolbar( QToolBar* toolbar );

	// ---------------------------------------------------------------------------------


	/** \brief This method is for internal use only. Calling this method
	* alone will not put 3ds Max in Expert mode. */
	void expertMode( bool on );

	// QMainWindow overrides
	virtual QMenu* createPopupMenu() override;

public Q_SLOTS:

	/** \brief Changes the dockingLocked state.
	 * \param[in] state The new dockingLocked state.
	 * \see dockingLocked() */
	void setDockingLocked( bool state );

protected:
	bool eventFilter( QObject* obj, QEvent* evt ) override;
	void childEvent( QChildEvent* evt ) override;
	bool event( QEvent* evt ) override;
	bool nativeEvent( const QByteArray& eventType, void* message, qintptr* result ) override;

	/** \brief Adds the default docking options for a given toolbar or dock widget 
	* to the specified menu. */
	bool addDefaultDockOptions( QWidget* dockWidget, QMenu* menu ) const;

	/** \brief Returns the child toolbar or dock widget which is currently under the mouse. */
	QWidget* dockWidgetUnderMouse() const;

private:
	Q_DECLARE_PRIVATE( QmaxMainWindow )
	Q_DISABLE_COPY( QmaxMainWindow )
	QmaxMainWindowPrivate* d_ptr;
};

};

Steps to reproduce
Steps to reproduce the behavior:

  1. Try to build 3ds Max dev branch dce7ca1aacb65e6606a7946bd1b7caf1ddd1b015
  2. Compilation fails on missing method QmaxMainWindow::raiseDockWidget

Expected behavior
It should build.

Attachments
If applicable, add screenshots, sample files, etc to help explain your problem.

Specs (if applicable):

  • OS & version [e.g. Windows 10]
  • Compiler & version [e.g. MSVS VS 2029 (16.11.34)]
  • 3ds Max version [e.g. 3ds Max 2025]
  • 3ds USD commit SHA [e.g. dev at caa921c1]
  • Pixar USD commit SHA [e.g. dev at b85ddac2]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions