Skip to content

Commit

Permalink
Rename basic "mmRenderer" to "MM Standard Renderer"
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cattermole committed Oct 10, 2024
1 parent 04a1545 commit 5517104
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 126 deletions.
7 changes: 6 additions & 1 deletion docs/source/nodes_display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ Display Nodes

*To be written.*

``mmRenderGlobals`` Nodes
``mmRenderGlobalsStandard`` Nodes
+++++++++++++++++++++++++

*To be written.*

``mmRenderGlobalsSilhouette`` Nodes
+++++++++++++++++++++++++

*To be written.*
6 changes: 3 additions & 3 deletions include/mmSolver/nodeTypeIds.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
#define MM_MARKER_GROUP_TRANSFORM_TYPE_NAME "mmMarkerGroupTransform"
#define MM_MARKER_GROUP_DRAW_CLASSIFY "drawdb/geometry/transform"

#define MM_RENDERER_BASIC_NAME "mmRenderer"
#define MM_RENDER_GLOBALS_BASIC_TYPE_ID 0x0012F194
#define MM_RENDER_GLOBALS_BASIC_TYPE_NAME "mmRenderGlobals"
#define MM_RENDERER_STANDARD_NAME "mmRendererStandard"
#define MM_RENDER_GLOBALS_STANDARD_TYPE_ID 0x0012F194
#define MM_RENDER_GLOBALS_STANDARD_TYPE_NAME "mmRenderGlobalsStandard"

#define MM_RENDERER_SILHOUETTE_NAME "mmRendererSilhouette"
#define MM_RENDER_GLOBALS_SILHOUETTE_TYPE_ID 0x0012F18E
Expand Down
2 changes: 1 addition & 1 deletion mel/AETemplates/AEmmRenderGlobalsSilhouetteTemplate.mel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
// ---------------------------------------------------------------------
//
// mmRenderer Render Globals AE Template
// Silhouette Renderer Render Globals AE Template
//

global proc AEmmRenderGlobalsSilhouetteTemplate(string $name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
// along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
// ---------------------------------------------------------------------
//
// mmRenderer Render Globals AE Template
// Standard Renderer Render Globals AE Template
//

global proc AEmmRenderGlobalsTemplate(string $name) {
global proc AEmmRenderGlobalsStandardTemplate(string $name) {
string $parent = `setParent -q`;

editorTemplate -beginScrollLayout;
Expand Down
11 changes: 6 additions & 5 deletions mel/mmRendererSilhouetteOptionBox.mel
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@
//

global proc mmRendererSilhouetteOptionBox() {
print("mmRendererSilhouetteOptionBox");
if (!`objExists "mmRenderGlobalsSilhouette"`) {
string $node = `createNode "mmRenderGlobalsSilhouette"
-name "mmRenderGlobalsSilhouette"
// print("mmRendererSilhouetteOptionBox");
string $node_type = "mmRenderGlobalsSilhouette";
if (!`objExists $node_type`) {
string $node = `createNode $node_type
-name $node_type
-shared -skipSelect`;
lockNode -lock on $node;
}
select -r "mmRenderGlobalsSilhouette";
select -r $node_type;

// Users want to be able to select and change the color swatch, so
// we need the attribute editor open.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
//
//

global proc mmRendererOptionBox() {
print("mmRendererOptionBox");
if (!`objExists "mmRenderGlobals"`) {
string $node = `createNode "mmRenderGlobals"
-name "mmRenderGlobals"
global proc mmRendererStandardOptionBox() {
// print("mmRendererStandardOptionBox");
string $node_type = "mmRenderGlobalsStandard";
if (!`objExists $node_type`) {
string $node = `createNode $node_type
-name $node_type
-shared -skipSelect`;
lockNode -lock on $node;
}
select -r "mmRenderGlobals";
select -r $node_type;
return;
}
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ set(SOURCE_FILES
if (MMSOLVER_BUILD_RENDERER)
set(SOURCE_FILES
${SOURCE_FILES}
mmSolver/render/MMRendererBasicCmd.cpp
mmSolver/render/MMRendererStandardCmd.cpp
mmSolver/render/MMRendererSilhouetteCmd.cpp
mmSolver/render/RenderOverrideBasic.cpp
mmSolver/render/RenderGlobalsBasicNode.cpp
mmSolver/render/RenderOverrideStandard.cpp
mmSolver/render/RenderGlobalsStandardNode.cpp
mmSolver/render/RenderGlobalsSilhouetteNode.cpp
mmSolver/render/RenderOverrideSilhouette.cpp
mmSolver/render/ops/ClearOperation.cpp
Expand Down
38 changes: 20 additions & 18 deletions src/mmSolver/pluginMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@

// MM Renderer
#if MMSOLVER_BUILD_RENDERER == 1
#include "mmSolver/render/MMRendererBasicCmd.h"
#include "mmSolver/render/MMRendererSilhouetteCmd.h"
#include "mmSolver/render/RenderGlobalsBasicNode.h"
#include "mmSolver/render/MMRendererStandardCmd.h"
#include "mmSolver/render/RenderGlobalsSilhouetteNode.h"
#include "mmSolver/render/RenderOverrideBasic.h"
#include "mmSolver/render/RenderGlobalsStandardNode.h"
#include "mmSolver/render/RenderOverrideSilhouette.h"
#include "mmSolver/render/RenderOverrideStandard.h"
#endif

#define REGISTER_COMMAND(plugin, name, creator, syntax, stat) \
Expand Down Expand Up @@ -436,18 +436,20 @@ MStatus initializePlugin(MObject obj) {
markerTfmClassification, status);

#if MMSOLVER_BUILD_RENDERER == 1
REGISTER_COMMAND(plugin, mmsolver::render::MMRendererBasicCmd::cmdName(),
mmsolver::render::MMRendererBasicCmd::creator,
mmsolver::render::MMRendererBasicCmd::newSyntax, status);
REGISTER_COMMAND(plugin, mmsolver::render::MMRendererStandardCmd::cmdName(),
mmsolver::render::MMRendererStandardCmd::creator,
mmsolver::render::MMRendererStandardCmd::newSyntax,
status);
REGISTER_COMMAND(
plugin, mmsolver::render::MMRendererSilhouetteCmd::cmdName(),
mmsolver::render::MMRendererSilhouetteCmd::creator,
mmsolver::render::MMRendererSilhouetteCmd::newSyntax, status);

REGISTER_NODE(plugin, mmsolver::render::RenderGlobalsBasicNode::nodeName(),
mmsolver::render::RenderGlobalsBasicNode::m_id,
mmsolver::render::RenderGlobalsBasicNode::creator,
mmsolver::render::RenderGlobalsBasicNode::initialize, status);
REGISTER_NODE(
plugin, mmsolver::render::RenderGlobalsStandardNode::nodeName(),
mmsolver::render::RenderGlobalsStandardNode::m_id,
mmsolver::render::RenderGlobalsStandardNode::creator,
mmsolver::render::RenderGlobalsStandardNode::initialize, status);
REGISTER_NODE(
plugin, mmsolver::render::RenderGlobalsSilhouetteNode::nodeName(),
mmsolver::render::RenderGlobalsSilhouetteNode::m_id,
Expand Down Expand Up @@ -486,9 +488,9 @@ MStatus initializePlugin(MObject obj) {
shader_location += MString("/shader");
shader_manager->addShaderPath(shader_location);

mmsolver::render::RenderOverrideBasic* default_renderer_ptr =
new mmsolver::render::RenderOverrideBasic(
MM_RENDERER_BASIC_NAME);
mmsolver::render::RenderOverrideStandard* default_renderer_ptr =
new mmsolver::render::RenderOverrideStandard(
MM_RENDERER_STANDARD_NAME);
renderer->registerOverride(default_renderer_ptr);

mmsolver::render::RenderOverrideSilhouette*
Expand Down Expand Up @@ -619,7 +621,7 @@ MStatus uninitializePlugin(MObject obj) {
if (renderer) {
// Find override with the given name and deregister
const MHWRender::MRenderOverride* default_renderer_ptr =
renderer->findRenderOverride(MM_RENDERER_BASIC_NAME);
renderer->findRenderOverride(MM_RENDERER_STANDARD_NAME);
if (default_renderer_ptr) {
renderer->deregisterOverride(default_renderer_ptr);
delete default_renderer_ptr;
Expand All @@ -633,14 +635,14 @@ MStatus uninitializePlugin(MObject obj) {
}
}

DEREGISTER_COMMAND(plugin, mmsolver::render::MMRendererBasicCmd::cmdName(),
status);
DEREGISTER_COMMAND(
plugin, mmsolver::render::MMRendererStandardCmd::cmdName(), status);
DEREGISTER_COMMAND(
plugin, mmsolver::render::MMRendererSilhouetteCmd::cmdName(), status);

DEREGISTER_NODE(plugin,
mmsolver::render::RenderGlobalsBasicNode::nodeName(),
mmsolver::render::RenderGlobalsBasicNode::m_id, status);
mmsolver::render::RenderGlobalsStandardNode::nodeName(),
mmsolver::render::RenderGlobalsStandardNode::m_id, status);
DEREGISTER_NODE(
plugin, mmsolver::render::RenderGlobalsSilhouetteNode::nodeName(),
mmsolver::render::RenderGlobalsSilhouetteNode::m_id, status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

#include "MMRendererBasicCmd.h"
#include "MMRendererStandardCmd.h"

// Maya
#include <maya/M3dView.h>
Expand All @@ -29,26 +29,28 @@
#include <maya/MViewport2Renderer.h>

// MM Solver
#include "RenderOverrideBasic.h"
#include "RenderOverrideStandard.h"

namespace mmsolver {
namespace render {

MMRendererBasicCmd::MMRendererBasicCmd() {}
MMRendererStandardCmd::MMRendererStandardCmd() {}

MMRendererBasicCmd::~MMRendererBasicCmd() {}
MMRendererStandardCmd::~MMRendererStandardCmd() {}

void *MMRendererBasicCmd::creator() { return (void *)(new MMRendererBasicCmd); }
void *MMRendererStandardCmd::creator() {
return (void *)(new MMRendererStandardCmd);
}

MString MMRendererBasicCmd::cmdName() { return kRendererBasicCmdName; }
MString MMRendererStandardCmd::cmdName() { return kRendererStandardCmdName; }

MSyntax MMRendererBasicCmd::newSyntax() {
MSyntax MMRendererStandardCmd::newSyntax() {
MSyntax syntax;
syntax.enableQuery(true);
return syntax;
}

MStatus MMRendererBasicCmd::doIt(const MArgList &args) {
MStatus MMRendererStandardCmd::doIt(const MArgList &args) {
MStatus status = MStatus::kFailure;

MHWRender::MRenderer *renderer = MHWRender::MRenderer::theRenderer();
Expand All @@ -57,10 +59,11 @@ MStatus MMRendererBasicCmd::doIt(const MArgList &args) {
return status;
}

RenderOverrideBasic *override_ptr =
(RenderOverrideBasic *)renderer->findRenderOverride(kRendererBasicName);
RenderOverrideStandard *override_ptr =
(RenderOverrideStandard *)renderer->findRenderOverride(
kRendererStandardName);
if (override_ptr == nullptr) {
MGlobal::displayError(kRendererBasicCmdName + " is not registered.");
MGlobal::displayError(kRendererStandardCmdName + " is not registered.");
return status;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
* along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
* ====================================================================
*
* mmSolver Basic Renderer command.
* mmSolver Standard Renderer command.
*
* This command is used to query and edit values for the mmSolver
* Renderer.
*
* Create a 'mmRendererBasic' node used to store the attributes for the
* Create a 'mmRendererStandard' node used to store the attributes for the
* renderer in the scene.
*/

#ifndef MM_SOLVER_RENDER_MM_RENDERER_BASIC_CMD_H
#define MM_SOLVER_RENDER_MM_RENDERER_BASIC_CMD_H
#ifndef MM_SOLVER_RENDER_MM_RENDERER_STANDARD_CMD_H
#define MM_SOLVER_RENDER_MM_RENDERER_STANDARD_CMD_H

// Maya
#include <maya/MPxCommand.h>
Expand All @@ -36,13 +36,13 @@ namespace mmsolver {
namespace render {

/*
* MM Basic Renderer command.
* MM Standard Renderer command.
*/
class MMRendererBasicCmd : public MPxCommand {
class MMRendererStandardCmd : public MPxCommand {
public:
MMRendererBasicCmd();
MMRendererStandardCmd();

~MMRendererBasicCmd() override;
~MMRendererStandardCmd() override;

MStatus doIt(const MArgList &args) override;

Expand All @@ -56,4 +56,4 @@ class MMRendererBasicCmd : public MPxCommand {
} // namespace render
} // namespace mmsolver

#endif // MAYA_MM_SOLVER_RENDER_MM_RENDERER_BASIC_CMD_H
#endif // MAYA_MM_SOLVER_RENDER_MM_RENDERER_STANDARD_CMD_H
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Stores global values for the mmSolver viewport renderer.
*/

#include "RenderGlobalsBasicNode.h"
#include "RenderGlobalsStandardNode.h"

// Maya
#include <maya/M3dView.h>
Expand All @@ -37,37 +37,38 @@
#include <maya/MViewport2Renderer.h>

// MM Solver
#include "RenderOverrideBasic.h"
#include "RenderOverrideStandard.h"
#include "mmSolver/nodeTypeIds.h"
#include "mmSolver/render/data/RenderColorFormat.h"
#include "mmSolver/utilities/debug_utils.h"

namespace mmsolver {
namespace render {

MTypeId RenderGlobalsBasicNode::m_id(MM_RENDER_GLOBALS_BASIC_TYPE_ID);
MTypeId RenderGlobalsStandardNode::m_id(MM_RENDER_GLOBALS_STANDARD_TYPE_ID);

RenderGlobalsBasicNode::RenderGlobalsBasicNode() : m_attr_change_callback(0) {}
RenderGlobalsStandardNode::RenderGlobalsStandardNode()
: m_attr_change_callback(0) {}

RenderGlobalsBasicNode::~RenderGlobalsBasicNode() {
RenderGlobalsStandardNode::~RenderGlobalsStandardNode() {
if (m_attr_change_callback) {
MMessage::removeCallback(m_attr_change_callback);
}
}

MString RenderGlobalsBasicNode::nodeName() {
return MString(MM_RENDER_GLOBALS_BASIC_TYPE_NAME);
MString RenderGlobalsStandardNode::nodeName() {
return MString(MM_RENDER_GLOBALS_STANDARD_TYPE_NAME);
}

void RenderGlobalsBasicNode::postConstructor() {
void RenderGlobalsStandardNode::postConstructor() {
MObject obj = thisMObject();
if ((m_attr_change_callback == 0) && (!obj.isNull())) {
m_attr_change_callback =
MNodeMessage::addAttributeChangedCallback(obj, attr_change_func);
}
}

void RenderGlobalsBasicNode::attr_change_func(
void RenderGlobalsStandardNode::attr_change_func(
MNodeMessage::AttributeMessage msg, MPlug &plug, MPlug & /*other_plug*/,
void * /*client_data*/) {
const bool verbose = false;
Expand Down Expand Up @@ -95,11 +96,11 @@ void RenderGlobalsBasicNode::attr_change_func(
return;
}

RenderOverrideBasic *override_ptr =
(RenderOverrideBasic *)renderer->findRenderOverride(
MM_RENDERER_BASIC_NAME);
RenderOverrideStandard *override_ptr =
(RenderOverrideStandard *)renderer->findRenderOverride(
MM_RENDERER_STANDARD_NAME);
if (override_ptr == nullptr) {
MGlobal::displayError(kRendererBasicCmdName + " is not registered.");
MGlobal::displayError(kRendererStandardCmdName + " is not registered.");
return;
}

Expand All @@ -112,17 +113,17 @@ void RenderGlobalsBasicNode::attr_change_func(
view.refresh(/*all=*/false, /*force=*/true);
}

MStatus RenderGlobalsBasicNode::compute(const MPlug & /*plug*/,
MDataBlock & /*data*/) {
MStatus RenderGlobalsStandardNode::compute(const MPlug & /*plug*/,
MDataBlock & /*data*/) {
// This node does not compute any values.
return MS::kUnknownParameter;
}

void *RenderGlobalsBasicNode::creator() {
return (new RenderGlobalsBasicNode());
void *RenderGlobalsStandardNode::creator() {
return (new RenderGlobalsStandardNode());
}

MStatus RenderGlobalsBasicNode::initialize() { return MS::kSuccess; }
MStatus RenderGlobalsStandardNode::initialize() { return MS::kSuccess; }

} // namespace render
} // namespace mmsolver
Loading

0 comments on commit 5517104

Please sign in to comment.