Skip to content

Commit

Permalink
[!] fixed bounding box on mel script
Browse files Browse the repository at this point in the history
[!] removed compilation warnings on 64-bit
[!] moved coreLib and renderLib next to src folder, not within it
  • Loading branch information
joesfer committed Feb 14, 2012
1 parent 73d1b3d commit 7e850cd
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 31 deletions.
8 changes: 6 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "src/RenderLib"]
path = src/RenderLib
[submodule "RenderLib"]
path = RenderLib
url = git://github.com/joesfer/RenderLib.git

[submodule "CoreLib"]
path = CoreLib
url = git://github.com/joesfer/CoreLib.git
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ if(WIN32)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D NOMINMAX) # prevent windef.h min/max macros from interfering with stl's
add_definitions(-D REQUIRE_IOSTREAM)
add_definitions(-D _BOOL)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")

endif(MSVC)
Expand All @@ -42,8 +44,11 @@ find_package(OpenGL)
set( MAYA_HEADERS_DIR ${MAYA_ROOT}/include )
set( MAYA_LIBRARY_DIR ${MAYA_ROOT}/lib )

set( RENDERLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/RenderLib/include CACHE STRING "path to renderlib include folder" )
set( RENDERLIB_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/RenderLib/lib/${CMAKE_BUILD_TYPE} CACHE STRING "path to renderlib libray folder" )
set( CORELIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CoreLib/include CACHE STRING "path to coreLib include folder" )
set( CORELIB_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CoreLib/lib/${CMAKE_BUILD_TYPE} CACHE STRING "path to coreLib libray folder" )

set( RENDERLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/RenderLib/include CACHE STRING "path to renderlib include folder" )
set( RENDERLIB_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/RenderLib/lib/${CMAKE_BUILD_TYPE} CACHE STRING "path to renderlib libray folder" )

set ( LOCAL_WARNING_FLAGS /W3 )
set ( LOCAL_RTTI_FLAGS /GR )
Expand All @@ -53,10 +58,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)

# add base to include directories
include_directories ( ${PUBLIC_INCLUDE_DIRS} ${MAYA_HEADERS_DIR} ${RENDERLIB_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
link_directories ( ${PUBLIC_LIBRARY_DIRS} ${MAYA_LIBRARY_DIR} ${RENDERLIB_LIBRARY_DIR})
include_directories ( ${PUBLIC_INCLUDE_DIRS} ${MAYA_HEADERS_DIR} ${RENDERLIB_INCLUDE_DIR} ${CORELIB_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
link_directories ( ${PUBLIC_LIBRARY_DIRS} ${MAYA_LIBRARY_DIR} ${RENDERLIB_LIBRARY_DIR} ${CORELIB_LIBRARY_DIR})

set( RENDER_LIB RenderLib.lib )
set( CORE_LIB CoreLib.lib )
set( OPENGL_LIB opengl32.lib )
set ( MAYA_DEFINITIONS "_AFXDLL,_MBCS,NT_PLUGIN,REQUIRE_IOSTREAM" )
set( MAYASDK_LIBRARIES "Foundation.lib" "OpenMaya.lib" "OpenMayaUI.lib" "OpenMayaAnim.lib" "OpenMayaFX.lib" "OpenMayaRender.lib" )
Expand All @@ -65,7 +71,7 @@ set( MAYASDK_LIBRARIES "Foundation.lib" "OpenMaya.lib" "OpenMayaUI.lib" "OpenMay
file(GLOB_RECURSE SOURCE_FILES src/*.c src/*.cpp src/*.h src/*.inl src/*.hpp src/*.glsl src/*.ui)

add_library( ${MAYA_PLUGIN_NAME} SHARED ${SOURCE_FILES} )
target_link_libraries( ${MAYA_PLUGIN_NAME} ${MAYASDK_LIBRARIES} ${OPENGL_LIB} ${RENDER_LIB})
target_link_libraries( ${MAYA_PLUGIN_NAME} ${MAYASDK_LIBRARIES} ${OPENGL_LIB} ${RENDER_LIB} ${CORE_LIB})

set_target_properties( ${MAYA_PLUGIN_NAME} PROPERTIES COMPILE_DEFINITIONS ${MAYA_DEFINITIONS} )
set_target_properties( ${MAYA_PLUGIN_NAME} PROPERTIES OUTPUT_NAME ${MAYA_PLUGIN_NAME} )
Expand Down
1 change: 1 addition & 0 deletions CoreLib
Submodule CoreLib added at c2e08e
2 changes: 1 addition & 1 deletion MEL/growVeins.mel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ proc createGrower(string $sampler, string $meshTransform, string $locatorTransfo

// retrieve mesh bounds to work out the default thickness
$bounds = `xform -q -boundingBox $meshTransform`;
$width = $bounds[1] - $bounds[0];
$width = $bounds[3] - $bounds[0];

setAttr ($growerShape + ".thickness") ($width * 0.002);
// Create output mesh
Expand Down
24 changes: 20 additions & 4 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,32 @@ Compilation:
cd <grower_folder>
git clone git://github.com/joesfer/Grower.git

- The project depends on the RenderLib shared library, included as a submodule.
- The project depends on the CoreLib and RenderLib shared libraries, included as submodules.
in <grower_folder>
git submodules init
git submodules update

git should say Cloning into 'src/RenderLib'...
git should say
Cloning into 'CoreLib'...
Cloning into 'RenderLib'...

- Build CoreLib using CMake:

cd <grower_folder>/CoreLib
mkdir .build
cd .build
cmake ..

Under windows: cmake will generate a Visual studio solution on .build
Under linux: cmake will generate a GCC makefile

Build the library. If everything went well, a new folder structure
<grower_folder>/CoreLib/lib containing the static library
should have been generated.

- Build RenderLib using CMake:

cd <grower_folder>/src/RenderLib
cd <grower_folder>/RenderLib
mkdir .build
cd .build
cmake ..
Expand All @@ -51,7 +67,7 @@ Compilation:
Under linux: cmake will generate a GCC makefile

Build the library. If everything went well, a new folder structure
<grower_folder>/src/RenderLib/lib containing the static library
<grower_folder>/RenderLib/lib containing the static library
should have been generated.

- Build the Grower plugin using CMake:
Expand Down
1 change: 1 addition & 0 deletions RenderLib
Submodule RenderLib added at 9a778b
7 changes: 4 additions & 3 deletions src/MesherNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <maya/MFnPluginData.h>
#include <maya/MGlobal.h>
#include <maya/MFnMeshData.h>
#include <iostream>

#include <stack>

Expand All @@ -36,13 +37,13 @@

#define MCHECKERROR(STAT,MSG) \
if ( MS::kSuccess != STAT ) { \
cerr << MSG << endl; \
std::cerr << MSG << std::endl; \
return MS::kFailure; \
}

#define MCHECKERRORNORET(STAT,MSG) \
if ( MS::kSuccess != STAT ) { \
cerr << MSG << endl; \
std::cerr << MSG << std::endl; \
}

// You MUST change this to a unique value!!! The typeId is a 32bit value used
Expand Down Expand Up @@ -205,7 +206,7 @@ MStatus Shape::compute( const MPlug& plug, MDataBlock& data )

GrowerData* aoMeshData = static_cast< GrowerData* >( aoMeshHandle.asPluginData() );
if ( aoMeshData == NULL ) {
cerr << "output mesh data not calculated" << endl;
std::cerr << "output mesh data not calculated" << std::endl;
return MS::kFailure;
}

Expand Down
4 changes: 3 additions & 1 deletion src/MesherUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <maya/MDagPath.h>
#include <maya/MFnSingleIndexedComponent.h>

#include <iostream>

#define RANDOM_FLOAT (float)rand() / RAND_MAX

// Object and component color defines
Expand Down Expand Up @@ -80,7 +82,7 @@ void MesherUI::getDrawRequests( const MDrawInfo & info,
Shape* meshNode = (Shape*)surfaceShape();
GrowerData * geom = meshNode->MeshGeometry();
if ( NULL == geom ) {
cerr << "NO DrawRequest for Grower\n";
std::cerr << "NO DrawRequest for Grower" << std::endl;
return;
}

Expand Down
1 change: 0 additions & 1 deletion src/RenderLib
Submodule RenderLib deleted from 28f73f
14 changes: 0 additions & 14 deletions src/pluginMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "MesherNode.h"
#include "MesherUI.h"
#include "GrowerData.h"
#include "Command.h"

#include <maya/MFnPlugin.h>

Expand Down Expand Up @@ -60,12 +59,6 @@ MStatus initializePlugin( MObject obj )
return status;
}

status = plugin.registerCommand( "grow", GrowerCmd::creator, GrowerCmd::syntax );
if (!status) {
status.perror("registerCommand");
return status;
}

return status;
}

Expand Down Expand Up @@ -112,12 +105,5 @@ MStatus uninitializePlugin( MObject obj)
return status;
}

status = plugin.deregisterCommand( "grow" );
if (!status) {
status.perror("deregisterCommand");
return status;
}


return status;
}

0 comments on commit 7e850cd

Please sign in to comment.