Skip to content

Commit

Permalink
first submit
Browse files Browse the repository at this point in the history
  • Loading branch information
renc committed Jun 11, 2013
0 parents commit 72a81bb
Show file tree
Hide file tree
Showing 6 changed files with 387 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
215 changes: 215 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
#################
## Eclipse
#################

*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

#############
## Windows detritus
#############

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac crap
.DS_Store


#############
## Python
#############

*.py[co]

# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg
57 changes: 57 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
cmake_minimum_required(VERSION 2.8)

################
# mudbox
set (MUDBOXSDK_DIR "C:/Program Files/Autodesk/Mudbox 2014/SDK")
set (MUDBOXSDK_INC_DIR ${MUDBOXSDK_DIR}/include)
set (MUDBOXSDK_QT_INC_DIR
${MUDBOXSDK_INC_DIR}/QtCore
${MUDBOXSDK_INC_DIR}/QtGui
${MUDBOXSDK_INC_DIR}/QtOpenGL
)
set (MUDBOXSDK_LIB_DIR ${MUDBOXSDK_DIR}/lib)
set (MUDBOXSDK_LIB
cg.lib
cgGL.lib
EdgeBleeding.lib
MapExtractor.lib
MapExtractorAPI.lib
MudboxFramework.lib
phonon4.lib
QtCore4.lib
QtGui4.lib
QtNetwork4.lib
QtOpenGL4.lib
QtScript4.lib
QtSql4.lib
QtSvg4.lib
QtWebKit4.lib
QtXml4.lib
UVlessPainting.lib
)

include_directories ("${MUDBOXSDK_INC_DIR}" ${MUDBOXSDK_QT_INC_DIR})
link_directories ( "${MUDBOXSDK_LIB_DIR}")


################
#
project (Mudbox_custom_plugin_LayerOps)

set (PLUGIN_NAME Mudbox_custom_plugin_LayerOps)

set(SRC
PluginMain.cpp

LayerCleaner.h
LayerCleaner.cpp

)

add_library(${PLUGIN_NAME} SHARED ${SRC})

target_link_libraries(
${PLUGIN_NAME}

${MUDBOXSDK_LIB}
)
58 changes: 58 additions & 0 deletions LayerCleaner.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include <QtCore/QObject> // include this before mudbox headers.
#include <Mudbox/mudbox.h>
#include "LayerCleaner.h"

using namespace mudbox;

void CleanSculptLayers()
{
// traver all the geometries.
for (unsigned int iG = 0; iG < Kernel()->Scene()->GeometryCount(); ++iG)
{
Geometry *pG = Kernel()->Scene()->Geometry(iG);
if (!pG)
continue;

Store<Mesh *> aMeshes;
Store<LayerMeshData *> aLayers;

// go through all the sculpt layers of this geometry,
// they may lock to different levels though.
const unsigned int iLayerCount = pG->LayerCount();
for (unsigned int iL = 0; iL < iLayerCount; ++iL)
{
LayerMeshData *pLayer = pG->LayerData(iL);
if (!pLayer)
continue;

Mesh *pMesh = pLayer->Mesh(); pMesh;
aMeshes.Add(pLayer->Mesh());
aLayers.Add(pLayer);
}

SubdivisionLevel *pActiveLevel = pG->ActiveLevel();
for (unsigned int i = 0; i < aLayers.ItemCount(); ++i)
{
if (!aMeshes[i])
continue;

// sculpt layer can only be removed from the active level
// and this active level is the layer locked to.
pG->ChangeActiveLevel(dynamic_cast<SubdivisionLevel *>(aMeshes[i]));
aMeshes[i]->RemoveLayer(aLayers[i]);

// update the mesh renderer.
aMeshes[i]->ContentChanged();
MeshRenderer *pR = NULL;
for (unsigned int r = 0; pR = aMeshes[i]->ChildByClass<MeshRenderer>(r); ++r)
{
pR->OnMeshChange(MeshRenderer::changeVertexPosition);
pR->OnVertexPositionChange(-1, -1);
}
}
pG->ChangeActiveLevel(pActiveLevel);
pG->ContentChanged();
}
Kernel()->ViewPort()->Redraw();
Kernel()->Interface()->RefreshUI();
}
7 changes: 7 additions & 0 deletions LayerCleaner.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef LAYERCLEANER_H
#define LAYERCLEANER_H


void CleanSculptLayers();

#endif // LAYERCLEANER_H
28 changes: 28 additions & 0 deletions PluginMain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <QtCore/QObject> // include this before mudbox headers.
#include <Mudbox/mudbox.h>

#include "LayerCleaner.h"

using namespace mudbox;

void Initializer();
void MenuItemHandler_RemoveLayers();

static const char *sPluginName = "CustomLayerOp";
static const char *sPluginDescription = "some custom layer operations";
static const char *sPluginAuthorName = "";
static const char *sPluginURL = "";
// Register this plugin. The "Initializer" method will be called when the plugin is loaded.
MB_PLUGIN( sPluginName, sPluginDescription, sPluginAuthorName, sPluginURL, Initializer );

// This function will be called then the plugin is loaded.
void Initializer(void)
{
// Add a menu entry for this operation.
Kernel()->Interface()->AddCallbackMenuItem( mudbox::Interface::menuMesh, QString::null, QObject::tr("Remove all the sculpt layers"), MenuItemHandler_RemoveLayers);
}

void MenuItemHandler_RemoveLayers()
{
CleanSculptLayers();
}

0 comments on commit 72a81bb

Please sign in to comment.