get () def _exit_ ( self, * args ): self. warn ( "TemporaryDocument not detached before being " "garbage collected", RuntimeWarning ) def _enter_ ( self ): ''' Attaches the real temporary document and returns it. _odoc = None def _del_ ( self ): if self. ''' _slots_ = ( '_bdoc', '_odoc' ) def _init_ ( self ): super ( TemporaryDocument, self ). important:: The *TemporaryDocument* will not expect that the internal `BaseDocument` might actually be removed by any other mechanism but the :meth:`detach` method. note:: If `detach()` was not called after `attach()` and the *TemporaryDocument* is being deleted via the garbage collector, a `RuntimeWarning` will be issued but the document will not be detached. Use the `get()` method to obtain the wrapped *BaseDocument* or catch the return value of the context-manager. The *TemporaryDocument* can be re-used after it has been closed. When the document is no longer needed, the context-manager will close the document and remove it from the Cinema 4D document list or `detach()` must be called manually. To do so, one must call the `attach()` method or use it as a context-manager. When the *TemporaryDocument* is created, it is not immediately activated. class TemporaryDocument ( object ): ''' The *TemporaryDocument* provides, as the name implies, a temporary `` that can be used to perform operations in an isolated environment such as calling modeling commands or `c4d.CallCommand()`. Remove () # Note: The document will be removed before eventually inserting # a new document because if *doc* is the active document and is # empty, InsertBaseDocument will actually kill it before inserting # the new document. BaseDocument : raise TypeError ( "new_active_doc must be a BaseDocument object" ) successor = new_active_doc or doc. BaseDocument : raise TypeError ( "doc must be a BaseDocument object" ) if new_active_doc is not None and \ Otherwise, the next document of *doc* will be used (C4D default behaviour) or a new empty document is created if none exists. :param new_active_doc: If specified, this will become the new active Cinema 4D document. :param doc: The :class:`c4d.BaseDocument` to remove. This function *only* removes the document from the Cinema 4D document list so that it is still valid and can be accessed from Python. it can not be used anymore aftert the function is called. def remove_document ( doc, new_active_doc = None ): ''' The Cinema 4D API only provides a :class:`~` function that not only removes the specified :class:`c4d.BaseDocument` from the document list, but really *kills* it, ie.
#POLYGON REDUCTION C4D UPDATE#
SetTime ( time ) if update : update_viewport () c4d. BaseTime ( frame, fps )) if update : update_viewport () c4d.
GetFrame ( fps ) for frame in xrange ( start, end + 1 ): doc. GetFrame ( fps ) if isinstance ( end, c4d.
:param update: If True, the viewport is updated with :func:`update_viewport` and :func:`c4d.GeSyncMessage` before the current frame number is passed to the caller. :param end: The end time, either :class:`c4d.BaseTime` or a frame number. :param start: The start time, either :class:`c4d.BaseTime` or a frame number. code-block:: python for frame in iter_timeline(doc, 0, 100): pass # process current frame here :param doc: The :class:`c4d.BaseDocument` to iterate in.
The document time will be reset to the original time at the end of the iteration. def walk_timeline ( doc, start, end, update = True ): ''' Iterate over each frame in the document from *start* to *end* and yield the current frame number while redrawing the viewport if *update* is True. ''' import c4d import warnings # General Helpers ''' Common utility functions related to the Cinema 4D API.
#POLYGON REDUCTION C4D SOFTWARE#
IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
#POLYGON REDUCTION C4D FREE#
# -*- coding: utf8 -*- # Copyright (C) 2015 Niklas Rosenstein # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software.