Пример #1
0
def get_pvm_consent_from_the_user():
    """
  Returns the state of the user consent for PVM terms of service.

  The dialog is shown that prompts the user to agree on PVM terms.
  If the user accepts and checks "don't show" checkbox, the dialog doesn't
  appear again and this function returns True.

  :return boolean: True if user consents and False otherwise.
  """
    settings = import_zync_module('settings')
    if not settings.Settings.get().get_pvm_ack():
        pvm_consent_dialog = PvmConsentDialog()
        pvm_consent_dialog.Open(dlgtype=c4d.DLG_TYPE_MODAL)
        if not pvm_consent_dialog.result:
            return False
        if pvm_consent_dialog.dont_show:
            settings.Settings.get().put_pvm_ack(True)
    return True
Пример #2
0
from importlib import import_module
import os

from zync_c4d_render_settings import C4dRenderingFailedException
from zync_c4d_utils import import_zync_module

zync = import_zync_module('zync')
zync_threading = import_zync_module('zync_threading')
main_thread = zync_threading.InterruptibleMainThreadCaller.main_thread
main_thread_ignore_interrupts = \
  zync_threading.InterruptibleMainThreadCaller.main_thread_ignore_interrupts
c4d = import_module('c4d')


class VRayExporter(zync_threading.InterruptibleMainThreadCaller):
    """
  Exports V-Ray scene to stand-alone file.

  While this is a background task, methods run in the main thread and must be split into few
  operations,
  because C4D requires them to go through event handling loop in order to be propagated between
  calls.

  Callback on_export_finished is called after the scene is exported. It accepts two arguments,
  path to exported vrscene(s) and final job params for submission.

  :param zync_threading.MainThreadExecutor executor:
  :param str vrscene_path: Output path for vrscene file.
  :param dict params: Job parameters.
  :param zync_c4d_scene_settings.C4dSceneSettings scene_settings:
  :param zync_c4d_render_settings.C4dRenderSettings render_settings:
""" Contains C4dSceneSettings class. """

from importlib import import_module
import re

from zync_c4d_take_settings import C4dTakeSettings
import zync_c4d_utils

zync_threading = zync_c4d_utils.import_zync_module('zync_threading')
main_thread = zync_threading.MainThreadCaller.main_thread
c4d = import_module('c4d')

win_drive_letter_regex = re.compile('^[a-zA-Z]:$')


class C4dSceneSettings(zync_threading.MainThreadCaller):
  """
  Implements various scene-related operations using C4D API.

  :param zync_threading.MainThreadExecutor main_thread_executor:
  :param c4d.documents.BaseDocument document:
  """

  def __init__(self, main_thread_executor, document):
    zync_threading.MainThreadCaller.__init__(self, main_thread_executor)
    self._document = document

  @main_thread
  def get_all_assets(self):
    """
    Returns all scene assets.
Пример #4
0
from functools import partial

import plugin_version
import zync_c4d_constants
import zync_c4d_utils
from zync_c4d_pvm_consent_dialog import get_pvm_consent_from_the_user
from zync_c4d_render_settings import C4dRenderFormatUnsupportedException
from zync_c4d_render_settings import C4dRendererSettingsUnavailableException
from zync_c4d_utils import import_zync_module
from zync_c4d_vray_exporter import VRayExporter
from zync_c4d_vray_settings import C4dVrayVersionException

SYMBOLS = zync_c4d_constants.SYMBOLS
from zync_c4d_presenter import Presenter

zync = import_zync_module('zync')
zync_preflights = import_zync_module('zync_preflights')
common_preflights = import_zync_module('zync_preflights.common_checks')


class ValidationError(Exception):
    """ Error in user-specified parameters or scene settings. """


class JobPresenter(Presenter):
    """
  Implements presenter for job view.

  :param zync_c4d_dialog.ZyncDialog dialog:
  :param zync_c4d_main_presenter.MainPresenter main_presenter:
  :param zync.Zync zync_connection: