From 4d8c844d3dc8ac04f254da068670be7f8989e82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8D=E4=B9=8B=E5=B9=BB=E7=81=B5?= Date: Sat, 22 May 2021 18:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc.bat | 10 +++-- doc/Makefile | 20 ++++++++++ doc/make.bat | 35 +++++++++++++++++ doc/source/conf.py | 86 +++++++++++++++++++++++++++++++++++++++++ doc/source/contents.rst | 14 +++++++ doc/source/index.rst | 13 +++++++ src/CPMel/__init__.py | 4 +- 7 files changed, 177 insertions(+), 5 deletions(-) create mode 100644 doc/Makefile create mode 100644 doc/make.bat create mode 100644 doc/source/conf.py create mode 100644 doc/source/contents.rst create mode 100644 doc/source/index.rst diff --git a/doc.bat b/doc.bat index 96416ba..a0ff47f 100644 --- a/doc.bat +++ b/doc.bat @@ -1,4 +1,6 @@ -cd NODE/doc -new -cd .. -cd .. \ No newline at end of file +del /q /s "./doc/source/cpmel/" +rd /s /q "./doc/source/cpmel/" +del /q /s "./doc/build/" +rd /s /q "./doc/build/" +"C:\Program Files\Autodesk\Maya2018\Python\Scripts\sphinx-apidoc" -l -f -o ./doc/source/cpmel/ ./build/debug/ -d 4 +"C:\Program Files\Autodesk\Maya2018\Python\Scripts\sphinx-build" -b html ./doc/source/ ./doc/build/ \ No newline at end of file diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 0000000..922152e --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 0000000..9abd665 --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,86 @@ +#!/usr/bin/python +# -*-coding:utf-8 -*- +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +import pymel + +code_dir = r'D:\Development\python\CPMel\src' +sys.path.insert(0, os.path.abspath(code_dir)) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/api/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/cmds/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/cmds/node/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/core/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/mayaPlug/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/mayaPlug/API_1/')) +sys.path.insert(0, os.path.abspath(code_dir + '/CPMel/mayaPlug/API_2/')) + +# import maya.standalone +# +# maya.standalone.initialize(name = 'python') +# sys.path.insert(0, os.path.abspath('.')) + + +from recommonmark.parser import CommonMarkParser + +source_parsers = { + '.md': CommonMarkParser, +} +# -- Project information ----------------------------------------------------- + +project = u'CPMEL' +copyright = u'2020, 苍之幻灵' +author = u'苍之幻灵' + +# The full version, including alpha/beta/rc tags +release = '2.0.0' + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.mathjax', + 'sphinx.ext.ifconfig', + 'sphinx.ext.viewcode', + 'sphinx.ext.githubpages', +] +source_suffix = ['.rst'] +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] diff --git a/doc/source/contents.rst b/doc/source/contents.rst new file mode 100644 index 0000000..abfbe55 --- /dev/null +++ b/doc/source/contents.rst @@ -0,0 +1,14 @@ +CPMEL +================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + +* :ref:`genindex` +* :ref:`modindex` + +.. automodule:: CPMel + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000..a1bb580 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,13 @@ +CPMEL +================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + +* :ref:`genindex` +* :ref:`modindex` +.. automodule:: CPMel + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/src/CPMel/__init__.py b/src/CPMel/__init__.py index 6c273a5..a684a44 100644 --- a/src/CPMel/__init__.py +++ b/src/CPMel/__init__.py @@ -80,11 +80,13 @@ * 使用CLI 注意2.7的CLI还不完善将于!!!CPMel3版本稳定CLI功能 """ + from . import initializeMaya import os import sys import maya.cmds + sys.cpmel_data = dict() MAYAINDEX = int(maya.cmds.about(v=True)) @@ -132,4 +134,4 @@ maya.cmds.pluginInfo(cc=cmds.upcommands) del maya if hasattr(sys, "cpmel_data"): - del sys.cpmel_data \ No newline at end of file + del sys.cpmel_data