Skip to content

Commit

Permalink
Bugfixes, Python Plugin Improvements (#32)
Browse files Browse the repository at this point in the history
- Detailed bridge version now printed to Cinema4D console
- Custom Documents support for Cinema4D R21/Python2
- confirmed working on Cinema 4D R21.207
  • Loading branch information
danielbui78 authored Jun 23, 2022
1 parent e001d59 commit dd8352f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 14 deletions.
27 changes: 24 additions & 3 deletions Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
DZBRIDGE_VERSION_MAJOR = 2022
DZBRIDGE_VERSION_MINOR = 1
DZBRIDGE_VERSION_REVISION = 9
DZBRIDGE_VERSION_BUILD = 21
DZBRIDGE_VERSION_STRING = "v%s.%s.%s.%s" % (DZBRIDGE_VERSION_MAJOR, DZBRIDGE_VERSION_MINOR, DZBRIDGE_VERSION_REVISION, DZBRIDGE_VERSION_BUILD)
##
## DazToC4D
##
## Copyright 2020 Daz Productions, Inc.
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this project except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
"""
The MIT License (MIT)
Expand Down Expand Up @@ -77,7 +98,7 @@ import importlib
import os
import sys

print("Python Version is {0}".format(sys.version_info))
print("DazToC4D: Python Version is {}.{}.{} {}".format(sys.version_info.major, sys.version_info.minor, sys.version_info.micro, sys.version_info.releaselevel))

if sys.version_info > (3, 0):
check = importlib.util.find_spec("ptvsd") is not None
Expand Down Expand Up @@ -217,5 +238,5 @@ def main():

if __name__ == "__main__":
main()
print("DazToC4D : has successfully loaded")
print("DaztoC4D : Exports to {0}.".format(EXPORT_DIR))
print("DazToC4D: has successfully loaded, version {}.".format(DZBRIDGE_VERSION_STRING))
print("DaztoC4D: Intermediate folder location is \"{0}\".".format(EXPORT_DIR))
25 changes: 18 additions & 7 deletions Cinema 4D/appdir_common/plugins/DazToC4D/lib/Definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
import platform

if (platform.system() == "Windows"):
import ctypes.wintypes
CSIDL_PERSONAL=5
SHGFP_TYPE_CURRENT=0
buffer = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
ctypes.windll.shell32.SHGetFolderPathW(0, CSIDL_PERSONAL, 0, SHGFP_TYPE_CURRENT, buffer)
HOME_DIR = buffer.value
try:
import ctypes.wintypes
csidl=5 # My Documents Folder (CSIDL_PERSONAL)
access_token=None # Current User
flags=0 # Current Value (SHGFP_TYPE_CURRENT)
buffer = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
result = ctypes.windll.shell32.SHGetFolderPathW(0, csidl, access_token, flags, buffer)
if result != 0:
if result < 0:
result += 2**32
print("ERROR: SHGetFolderPathW() returned error code=[" + str(hex(result)) + "]")
del buffer
raise Exception()
HOME_DIR = buffer.value
except:
HOME_DIR = os.path.expanduser("~").replace("\\","/") + "/Documents"
print("Unable to query the correct Documents path for Windows, failing back to user folder=\"" + str(HOME_DIR) + "\".")
elif (platform.system() == "Darwin"):
HOME_DIR = os.path.expanduser("~") + "/Documents"
else:
HOME_DIR = os.path.expanduser("~")

ROOT_DIR = os.path.join(HOME_DIR, "DAZ 3D", "Bridges", "Daz To Cinema 4D")
EXPORT_DIR = os.path.join(ROOT_DIR, "Exports")
EXPORT_DIR = os.path.join(ROOT_DIR, "Exports").replace("\\","/")

LIB_DIR = os.path.dirname(__file__)
PLUGIN_DIR = os.path.dirname(LIB_DIR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import redshift

except ImportError:
print("DaztoC4D : Redshift not installed can not convert.")
print("DaztoC4D: Redshift not installed can not convert.")


def _GetNextHierarchyObject(op):
Expand Down Expand Up @@ -44,7 +44,7 @@ def check_for_redshift(self):

return True
except ImportError:
print("DaztoC4D : Redshift not installed can not convert.")
print("DaztoC4D: Redshift not installed can not convert.")
return False

def execute(self):
Expand Down
Binary file modified DazStudioPlugin/Resources/c4dplugin.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions DazStudioPlugin/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Version number for dzBridge-C4D
#define PLUGIN_MAJOR 2022
#define PLUGIN_MINOR 1
#define PLUGIN_REV 8
#define PLUGIN_BUILD 19
#define PLUGIN_REV 9
#define PLUGIN_BUILD 21

#define PLUGIN_VERSION DZ_MAKE_VERSION( PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_REV, PLUGIN_BUILD )

0 comments on commit dd8352f

Please sign in to comment.