Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nuke extension #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Support/Library/ofxsParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ namespace OFX {
_paramProps.propSetInt(kOfxParamPropEnabled, v);
}

void ParamDescriptor::setLayoutHint(const LayoutHintEnum layoutHint)
{
// This is a nuke ofx extension property, so it's optional.
_paramProps.propSetInt(kOfxParamPropLayoutHint, static_cast<int>(layoutHint), false);
}

/** @brief set the group param that is the parent of this one, default is to be ungrouped at the root level */
void
ParamDescriptor::setParent(const GroupParamDescriptor &v)
Expand Down Expand Up @@ -890,6 +896,13 @@ namespace OFX {
_paramProps.propSetInt(kOfxParamPropGroupOpen, v, false); // introduced in OFX 1.2
}

void GroupParamDescriptor::setAsTab()
{
// PropGroupIdTab is a nuke extension
_paramProps.propSetInt(kFnOfxParamPropGroupIsTab, 1,
false); // this property is an optional extension, don't throw if not present.
}

////////////////////////////////////////////////////////////////////////////////
// page param descriptor

Expand Down
12 changes: 12 additions & 0 deletions Support/include/ofxsParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ each represent the actions that can be carried out on those particular OFX objec
#include <memory>
#include "ofxsCore.h"

#include "extensions/nuke/fnPublicOfxExtensions.h"
/** @brief Nasty macro used to define empty protected copy ctors and assign ops */
#define mDeclareProtectedAssignAndCC(CLASS) \
CLASS &operator=(const CLASS &) {assert(false); return *this;} \
Expand Down Expand Up @@ -170,6 +171,13 @@ namespace OFX {
#endif
};

enum LayoutHintEnum
{
eLayoutHintNormal = kOfxParamPropLayoutHintNormal,
eLayoutHintDivider = kOfxParamPropLayoutHintDivider,
eLayoutHintNoNewLine = kOfxParamPropLayoutHintNoNewLine
};

/** @brief Enumerates the differing types of coordinate system for default values */
enum DefaultCoordinateSystemEnum {
eCoordinatesCanonical, //!< canonical coordinate system
Expand Down Expand Up @@ -239,6 +247,8 @@ namespace OFX {
bool getHostHasNativeOverlayHandle() const;

void setUseHostNativeOverlayHandle(bool use);

void setLayoutHint(const LayoutHintEnum layoutHint);
};

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -636,6 +646,8 @@ namespace OFX {
public :
/** @brief whether the initial state of a group is open or closed in a hierarchical layout, defaults to false */
void setOpen(const bool v);

void setAsTab();
};

////////////////////////////////////////////////////////////////////////////////
Expand Down
157 changes: 157 additions & 0 deletions include/extensions/nuke/fnPublicOfxExtensions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
//------------------------------------------------------------------------------
// Apps/Nuke/nuke/src/fnPublicOfxExtensions.h
//
// Copyright (c) 2009 The Foundry Visionmongers Ltd. All Rights Reserved.
//------------------------------------------------------------------------------

#ifndef _fnPublicOfxExtensions_h_
#define _fnPublicOfxExtensions_h_

/*
Software License :

Copyright (c) 2009, The Foundry Visionmongers Ltd. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name The Foundry Visionmongers Ltd, nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "ofxImageEffect.h"

/** @brief Whether or not the parameter is transiently hidden

- Type - bool X 1
- Property Set - plugin parameter descriptor (read/write) and instance (read/write)
- Default - 0
- Valid Values - 0, 1
0 - not hidden
1 - hidden

This is a property on all parameters.

*/
#define kOfxParamPropHidden "OfxParamPropHidden"

/** @brief Layout hint for hierarchical layouts

- Type - int X 1
- Property Set - plugin parameter descriptor (read/write) and instance (read only)
- Default - 0
- Valid Values - 0,1 or 2
0 - for a new line after the parameter
1 - for a seperator between this parameter and the one to follow
2 - for no new line, continue the next parameter on the same horizontal level

This is a property on parameters of type ::kOfxParamPropLayoutHint, and tells the group whether it should be open or closed by default.

*/
#define kOfxParamPropLayoutHint "OfxParamPropLayoutHint"

// lay out as normal
#define kOfxParamPropLayoutHintNormal 0

// put a divider after parameter
#define kOfxParamPropLayoutHintDivider 1

// have the next parameter start on the same line as this
#define kOfxParamPropLayoutHintNoNewLine 2

/** @brief Layout padding for hierarchical views, only pertinent with kOfxParamPropLayoutHint==2

- Type - int X 1
- Property Set - plugin parameter descriptor (read/write) and instance (read only)
- Default - 0
- Valid Values - any positive integer value

This is a property on parameters of type ::kOfxParamPropLayoutPadWidth
It tells the host how much space (in pixels) to leave between the current parameter and the next parameter in horizontal layouts.
*/
#define kOfxParamPropLayoutPadWidth "OfxParamPropLayoutPadWidth"

/** @brief The suggested colour of an overlay colour in an interact.

- Type - double X 3
- Property Set - plugin parameter descriptor (read/write) and instance (read only)
- Default - 1.0
- Valid Values - greater than or equal to 0.0

This is a property of an overlay interact instance.
*/
#define kOfxPropOverlayColour "OfxPropOverlayColour"

/** @brief Unique user readable version string for that identifies something from other versions

- Type - string X 1
- Property Set - host descriptor (read only), plugin descriptor (read/write)
- Default - none, the host needs to set this
- Valid Values - ASCII string
*/
#define kOfxPropVersionLabel "OfxPropVersionLabel"

/** @brief The displayed named of the host

- Type - string X 1
- Property Set - host descriptor (read only), plugin descriptor (read/write)
- Default - none
- Valid Values - ASCII string
*/
#define kOfxPropHostProductTitle "OfxPropHostProductTitle"

/** @brief The major version of the host

- Type - int X 1
- Property Set - param set instance (read/write)
- Default - none
- Valid Values - any positive integer values
*/
#define kOfxPropHostMajorVersion "OfxPropHostMajorVersion"

/** @brief The minor version of the host

- Type - int X 1
- Property Set - param set instance (read/write)
- Default - none
- Valid Values - any positive integer values
*/
#define kOfxPropHostMinorVersion "OfxPropHostMinorVersion"

/** @brief The build version of the host

- Type - string X 1
- Property Set - host descriptor (read only), plugin descriptor (read/write)
- Default - none
- Valid Values - ASCII string
*/
#define kOfxPropHostBuildVersion "OfxPropHostBuildVersion"

/** @brief Whether to display a group as a tab

- Type - int X 1
- Property Set - plugin parameter descriptor (read/write) and instance (read only)
- Default - 0
- Valid Values - ASCII string
*/
#define kFnOfxParamPropGroupIsTab "FnOfxParamPropGroupIsTab"


#endif