Skip to content

Commit

Permalink
Rename Default MM Renderer to "MM Renderer Basic"
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cattermole committed Oct 7, 2023
1 parent 1d04c4b commit f624629
Show file tree
Hide file tree
Showing 20 changed files with 1,909 additions and 76 deletions.
12 changes: 6 additions & 6 deletions include/mmSolver/nodeTypeIds.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@
#define MM_MARKER_GROUP_TRANSFORM_TYPE_NAME "mmMarkerGroupTransform"
#define MM_MARKER_GROUP_DRAW_CLASSIFY "drawdb/geometry/transform"

#define MM_DEFAULT_RENDERER_NAME "mmDefaultRenderer"
#define MM_DEFAULT_RENDER_GLOBALS_TYPE_ID 0x0012F194
#define MM_DEFAULT_RENDER_GLOBALS_TYPE_NAME "mmDefaultRenderGlobals"
#define MM_RENDERER_BASIC_NAME "mmRenderer"
#define MM_RENDER_GLOBALS_BASIC_TYPE_ID 0x0012F194
#define MM_RENDER_GLOBALS_BASIC_TYPE_NAME "mmRenderGlobals"

#define MM_SILHOUETTE_RENDERER_NAME "mmSilhouetteRenderer"
#define MM_SILHOUETTE_RENDER_GLOBALS_TYPE_ID 0x0012F18E
#define MM_SILHOUETTE_RENDER_GLOBALS_TYPE_NAME "mmSilhouetteRenderGlobals"
#define MM_RENDERER_SILHOUETTE_NAME "mmRendererSilhouette"
#define MM_RENDER_GLOBALS_SILHOUETTE_TYPE_ID 0x0012F18E
#define MM_RENDER_GLOBALS_SILHOUETTE_TYPE_NAME "mmRenderGlobalsSilhouette"

#define MM_SKY_DOME_SHAPE_TYPE_ID 0x0012F195
#define MM_SKY_DOME_SHAPE_TYPE_NAME "mmSkyDomeShape"
Expand Down
64 changes: 64 additions & 0 deletions mel/AETemplates/AEmmRenderGlobalsSilhouetteTemplate.mel
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// Copyright (C) 2023 David Cattermole.
//
// This file is part of mmSolver.
//
// mmSolver is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// mmSolver is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
// ---------------------------------------------------------------------
//
// mmRenderer Render Globals AE Template
//

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

editorTemplate -beginScrollLayout;

editorTemplate -beginNoOptimize;

editorTemplate
-beginLayout "Attributes"
-collapse false;

editorTemplate
-label "Enable"
-addControl "enable";

editorTemplate
-label "Depth Offset"
-addControl "depthOffset";

editorTemplate
-label "Width"
-addControl "width";

editorTemplate
-label "Color"
-addControl "color";

editorTemplate
-label "Alpha"
-addControl "alpha";

editorTemplate -endLayout;

editorTemplate -endNoOptimize;

editorTemplate -addExtraControls;

// include/call base class/node attributes
AEabstractBaseCreateTemplate $name;

editorTemplate -endScrollLayout;
}
44 changes: 44 additions & 0 deletions mel/AETemplates/AEmmRenderGlobalsTemplate.mel
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright (C) 2023 David Cattermole.
//
// This file is part of mmSolver.
//
// mmSolver is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// mmSolver is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
// ---------------------------------------------------------------------
//
// mmRenderer Render Globals AE Template
//

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

editorTemplate -beginScrollLayout;

editorTemplate -beginNoOptimize;

editorTemplate
-beginLayout "Attributes"
-collapse false;

editorTemplate -endLayout;

editorTemplate -endNoOptimize;

editorTemplate -addExtraControls;

// include/call base class/node attributes
AEabstractBaseCreateTemplate $name;

editorTemplate -endScrollLayout;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
//
//

global proc mmSilhouetteRendererOptionBox() {
print("mmSilhouetteRendererOptionBox");
if (!`objExists "mmSilhouetteRenderGlobals"`) {
string $node = `createNode "mmSilhouetteRenderGlobals"
-name "mmSilhouetteRenderGlobals"
global proc mmRendererOptionBox() {
print("mmRendererOptionBox");
if (!`objExists "mmRenderGlobals"`) {
string $node = `createNode "mmRenderGlobals"
-name "mmRenderGlobals"
-shared -skipSelect`;
lockNode -lock on $node;
}
select -r "mmSilhouetteRenderGlobals";
select -r "mmRenderGlobals";
return;
}
44 changes: 44 additions & 0 deletions mel/mmRendererSilhouetteOptionBox.mel
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright (C) 2021 David Cattermole.
//
// This file is part of mmSolver.
//
// mmSolver is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// mmSolver is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
// ---------------------------------------------------------------------
//
// When creating an MRenderOverride plug-in, you can do the following
// to add an option box to open a dialog that supports UI configurable
// user options:
//
// If your MRenderOverride's name is FooRenderer, then provide a
// global MEL procedure named FooRendererOptionBox (ensure that
// OptionBox is added as a postfix ), and the option box icon will
// appear beside the viewport menu item automatically.
//
// You can manage the UI layout of the option dialog box in the
// FooRendererOptionBox procedure.
//
//

global proc mmRendererSilhouetteOptionBox() {
print("mmRendererSilhouetteOptionBox");
if (!`objExists "mmRenderGlobalsSilhouette"`) {
string $node = `createNode "mmRenderGlobalsSilhouette"
-name "mmRenderGlobalsSilhouette"
-shared -skipSelect`;
lockNode -lock on $node;
}
select -r "mmRenderGlobalsSilhouette";
return;
}
12 changes: 6 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ set(SOURCE_FILES
if (MMSOLVER_BUILD_RENDERER)
set(SOURCE_FILES
${SOURCE_FILES}
mmSolver/render/DefaultRenderGlobalsNode.cpp
mmSolver/render/DefaultRenderOverride.cpp
mmSolver/render/MMDefaultRendererCmd.cpp
mmSolver/render/MMSilhouetteRendererCmd.cpp
mmSolver/render/SilhouetteRenderGlobalsNode.cpp
mmSolver/render/SilhouetteRenderOverride.cpp
mmSolver/render/MMRendererBasicCmd.cpp
mmSolver/render/MMRendererSilhouetteCmd.cpp
mmSolver/render/RenderOverrideBasic.cpp
mmSolver/render/RenderGlobalsBasicNode.cpp
mmSolver/render/RenderGlobalsSilhouetteNode.cpp
mmSolver/render/RenderOverrideSilhouette.cpp
mmSolver/render/ops/ClearOperation.cpp
mmSolver/render/ops/SceneRender.cpp
mmSolver/render/ops/SceneRenderBase.cpp
Expand Down
73 changes: 36 additions & 37 deletions src/mmSolver/pluginMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@

// MM Renderer
#if MMSOLVER_BUILD_RENDERER == 1
#include "mmSolver/render/DefaultRenderGlobalsNode.h"
#include "mmSolver/render/DefaultRenderOverride.h"
#include "mmSolver/render/MMDefaultRendererCmd.h"
#include "mmSolver/render/MMSilhouetteRendererCmd.h"
#include "mmSolver/render/SilhouetteRenderGlobalsNode.h"
#include "mmSolver/render/SilhouetteRenderOverride.h"
#include "mmSolver/render/MMRendererBasicCmd.h"
#include "mmSolver/render/MMRendererSilhouetteCmd.h"
#include "mmSolver/render/RenderGlobalsBasicNode.h"
#include "mmSolver/render/RenderGlobalsSilhouetteNode.h"
#include "mmSolver/render/RenderOverrideBasic.h"
#include "mmSolver/render/RenderOverrideSilhouette.h"
#endif

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

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

REGISTER_NODE(
plugin, mmsolver::render::DefaultRenderGlobalsNode::nodeName(),
mmsolver::render::DefaultRenderGlobalsNode::m_id,
mmsolver::render::DefaultRenderGlobalsNode::creator,
mmsolver::render::DefaultRenderGlobalsNode::initialize, status);
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::SilhouetteRenderGlobalsNode::nodeName(),
mmsolver::render::SilhouetteRenderGlobalsNode::m_id,
mmsolver::render::SilhouetteRenderGlobalsNode::creator,
mmsolver::render::SilhouetteRenderGlobalsNode::initialize, status);
plugin, mmsolver::render::RenderGlobalsSilhouetteNode::nodeName(),
mmsolver::render::RenderGlobalsSilhouetteNode::m_id,
mmsolver::render::RenderGlobalsSilhouetteNode::creator,
mmsolver::render::RenderGlobalsSilhouetteNode::initialize, status);

// Register MM Solver Viewport Renderer.
//
Expand Down Expand Up @@ -447,15 +446,15 @@ MStatus initializePlugin(MObject obj) {
shader_location += MString("/shader");
shader_manager->addShaderPath(shader_location);

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

mmsolver::render::SilhouetteRenderOverride*
mmsolver::render::RenderOverrideSilhouette*
silhouette_renderer_ptr =
new mmsolver::render::SilhouetteRenderOverride(
MM_SILHOUETTE_RENDERER_NAME);
new mmsolver::render::RenderOverrideSilhouette(
MM_RENDERER_SILHOUETTE_NAME);
renderer->registerOverride(silhouette_renderer_ptr);
}
}
Expand Down Expand Up @@ -563,31 +562,31 @@ MStatus uninitializePlugin(MObject obj) {
if (renderer) {
// Find override with the given name and deregister
const MHWRender::MRenderOverride* default_renderer_ptr =
renderer->findRenderOverride(MM_DEFAULT_RENDERER_NAME);
renderer->findRenderOverride(MM_RENDERER_BASIC_NAME);
if (default_renderer_ptr) {
renderer->deregisterOverride(default_renderer_ptr);
delete default_renderer_ptr;
}

const MHWRender::MRenderOverride* silhouette_renderer_ptr =
renderer->findRenderOverride(MM_SILHOUETTE_RENDERER_NAME);
renderer->findRenderOverride(MM_RENDERER_SILHOUETTE_NAME);
if (silhouette_renderer_ptr) {
renderer->deregisterOverride(silhouette_renderer_ptr);
delete silhouette_renderer_ptr;
}
}

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

DEREGISTER_NODE(plugin,
mmsolver::render::DefaultRenderGlobalsNode::nodeName(),
mmsolver::render::DefaultRenderGlobalsNode::m_id, status);
mmsolver::render::RenderGlobalsBasicNode::nodeName(),
mmsolver::render::RenderGlobalsBasicNode::m_id, status);
DEREGISTER_NODE(
plugin, mmsolver::render::SilhouetteRenderGlobalsNode::nodeName(),
mmsolver::render::SilhouetteRenderGlobalsNode::m_id, status);
plugin, mmsolver::render::RenderGlobalsSilhouetteNode::nodeName(),
mmsolver::render::RenderGlobalsSilhouetteNode::m_id, status);
#endif

DEREGISTER_COMMAND(plugin, mmsolver::MMSolverCmd::cmdName(), status);
Expand Down
Loading

0 comments on commit f624629

Please sign in to comment.