[Aqsis-commits] [SCM] RIBMosaic Experimental branch master updated. 6ed26cefd9364c11f1953ef96cc67fd
Brought to you by:
ltatkinson,
pgregory
From: <gi...@aq...> - 2011-04-24 04:28:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "RIBMosaic Experimental". The branch, master has been updated via 6ed26cefd9364c11f1953ef96cc67fd30d19d3a2 (commit) via ebfa6d50060308a2567397e6055aa378440ca4c0 (commit) via bf9be263b151fdcdb013008cedda66ec65ac52f2 (commit) from 31265e32887900b347797f19dce7a59694a42111 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6ed26cefd9364c11f1953ef96cc67fd30d19d3a2 Author: Jeff Doyle (nfz) <she...@ea...> Date: Sun Apr 24 01:32:30 2011 -0300 Some RIB Archive modes now supported: INLINE, READARCHIVE, and NOEXPORT are now supported. INSTANCE and DELAYEDARCHIVE not fully supported and act just like READARCHIVE. UNREADARCHIVE not working yet. get_scene() method is now part of ExportArchive class instead of being defined in each subclass. This commit is for #7 issue on github repo: https://github.com/nfz/RIBMosaic-exp/issues/7 diff --git a/render_ribmosaic/rm_export.py b/render_ribmosaic/rm_export.py index 61d4388..28dcfba 100644 --- a/render_ribmosaic/rm_export.py +++ b/render_ribmosaic/rm_export.py @@ -818,6 +818,7 @@ class ExporterManager(): try: pa = ExportPass(ec, target_name) pa.export_rib() + pa.close_archive() del pa except: pa.close_archive() @@ -1014,6 +1015,31 @@ class ExporterArchive(rm_context.ExportContext): # #### Public methods + def archive_exists(self): + """ + check to see if the archive already exists as a file. + Sets _archive_exists to True if archive exists as a file. + Returns True if archive already exits. + """ + + exists = False # indicates that the archive already exits + + if self.archive_name: + filepath = self.archive_path + self.archive_name + + try: + exists = os.path.isfile(filepath) + + except: + raise rm_error.RibmosaicError( + "Could not check archive " + filepath, sys.exc_info()) + else: + raise rm_error.RibmosaicError( + "archive_exists: Archive's path and name must be specified") + + return exists + + def open_archive(self, gzipped=None, execute=None, mode='w'): """Opens a new archive for writing using archive_path and archive_name. @@ -1281,7 +1307,50 @@ class ExporterArchive(rm_context.ExportContext): archive.open_archive(mode='r') archive.close_archive() + def get_scene(self): + return rm.export_manager.export_scene + # helper methods for outputting RIB code + def open_rib_archive(self, archive_mode='DEFAULT'): + """ + Determine the open action to be taken with rib archive export. This + is based on the ribmosaic_rib_archive property and the scene's + ribmosaic_object_archives, ribmosaic_data_archives, + ribmosaic_material_archives properties. + + archive_mode = the mode in which the archive will be used: + INLINE, READARCHIVE, NOEXPORT, UNREADARCHIVE, INSTANCE, + DELAYEDARCHIVE, UNREADARCHIVE + """ + + # determine what type of export to do + archive_mode = self.pointer_datablock.ribmosaic_rib_archive + # for now just testing inline and readarchive + if archive_mode == 'DEFAULT': + if self.data_type in ['MESH']: + archive_mode = self.get_scene().ribmosaic_data_archives + elif self.data_type == 'MATERIAL': + archive_mode = self.get_scene().ribmosaic_material_archives + + if archive_mode in ['READARCHIVE', 'DELAYEDARCHIVE', 'INSTANCE']: + # make archive name + self.archive_name = self.data_name + '.rib' + # setup readarchive in parent archive + # rely on the file pointer still setup for the parent + self.riReadArchive() + # if archive does not exist then allow export + if not self.archive_exists(): + # Determine if compressed RIB is enabled + self.open_archive( + gzipped=self.get_scene().ribmosaic_compressrib) + else: + self._pointer_file = None + # since in own archive, start indentation at the left margin + self.current_indent = 0 + elif archive_mode == 'NOEXPORT': + self._pointer_file = None + # all other modes default to inline + def ribHeader(self): self.write_text("##RenderMan RIB-Structure 1.1\n") self.write_text("##Scene: %s\n" % rm.export_manager.export_scene.name) @@ -1292,6 +1361,9 @@ class ExporterArchive(rm_context.ExportContext): #self.write_text("##Frames: "+str(fraEnd-fraStart+1)+"\n") self.write_text("version 3.03\n") + def riReadArchive(self): + self.write_text('ReadArchive "%s"\n' % self.archive_name) + def riFrameBegin(self): self.write_text('FrameBegin %s\n' % self.current_rmframe) self.inc_indent() @@ -1610,6 +1682,7 @@ class ExportPass(ExporterArchive): try: eo = ExportObject(self, ob) eo.export_rib() + eo.close_archive() del eo except: eo.close_archive() @@ -1856,9 +1929,6 @@ class ExportPass(ExporterArchive): self.close_archive() - def get_scene(self): - return self.pointer_datablock - class ExportWorld(ExporterArchive): """Represents shaders on world data-blocks""" @@ -1997,6 +2067,9 @@ class ExportObject(ExporterArchive): if DEBUG_PRINT: print("ExportObject.export_rib()") + if self._pointer_file == None: + return + ob = self.get_object() # if a camera object then do special camera output @@ -2055,10 +2128,8 @@ class ExportObject(ExporterArchive): self.riAttributeEnd() self.write_text('\n') - self.close_archive() - def get_scene(self): - return self.pointer_parent.get_scene() + self.close_archive() def get_object(self): return self.pointer_datablock @@ -2162,6 +2233,7 @@ class ExportLight(ExporterArchive): self.riAttributeEnd() self.riIlluminate(self.current_lightid) self.write_text('\n', False) + self.close_archive() class ExportMaterial(ExporterArchive): @@ -2176,6 +2248,9 @@ class ExportMaterial(ExporterArchive): ExporterArchive.__init__(self, export_object, 'MAT') self._set_pointer_datablock(pointer_object) + # material has no type attribute + self.data_type = 'MATERIAL' + self.open_rib_archive() # #### Public methods @@ -2187,6 +2262,9 @@ class ExportMaterial(ExporterArchive): def export_rib(self): if DEBUG_PRINT: print("ExportMaterial.export_rib()") + # if no file pointer which indicates no export required then exit + if self._pointer_file == None: + return material = self.pointer_datablock if DEBUG_PRINT: @@ -2235,41 +2313,43 @@ class ExportMaterial(ExporterArchive): # output rib code for the shaders for p in material_shaders: p.current_indent = self.current_indent + p.archive_path = self.archive_path p.build_code("rib") + self.close_archive() + class ExportObjdata(ExporterArchive): """Represents geometry, lights and cameras using objectdata data-blocks. Can also handle export of multiple meshes setup in LOD list """ + blender_object = None + def __init__(self, export_object=None): """Initialize attributes using export_object and parameters. Automatically create the RIB this object data represents. export_object = Any object subclassed from ExportContext - """ + """ ExporterArchive.__init__(self, export_object, 'GEO') + self.blender_object = self.pointer_datablock + self._set_pointer_datablock(self.pointer_datablock.data) + self.open_rib_archive() - # Determine if compressed RIB is enabled - #if self.pointer_datablock: - # compress = self.pointer_datablock.ribmosaic_compressrib - #else: - # compress = False - #self.open_archive(gzipped=compress) def _export_geometry(self): if DEBUG_PRINT: print("ExportObjdata._export_geometry") # determine whate type of geometry is to be exported - prim = detect_primitive(self.get_object()) + prim = detect_primitive(self.blender_object) # create a mesh that has all modifiers applied to mesh data # but make sure subdiv modifier render option is false - mesh = create_mesh(self.get_scene(), self.get_object()) + mesh = create_mesh(self.get_scene(), self.blender_object) # set the file pointer for ribify rm.ribify.pointer_file = self._pointer_file # set the indent level of the rib output @@ -2282,7 +2362,7 @@ class ExportObjdata(ExporterArchive): elif prim == 'POINTS': rm.ribify.mesh_points(mesh) - meshdata = self.get_mesh() + meshdata = self.pointer_datablock # check if normal primvar is to be exported if meshdata.ribmosaic_n_export: pv_class = meshdata.ribmosaic_n_class @@ -2333,20 +2413,15 @@ class ExportObjdata(ExporterArchive): if DEBUG_PRINT: print('ExportObjData.export_rib()') + # if no file pointer which indicates no export required then exit + if self._pointer_file == None: + return + # determine what type of object data needs to be exported - if self.pointer_datablock.type in ('MESH', 'EMPTY'): + if self.blender_object.type in ('MESH', 'EMPTY'): self. _export_geometry() - # helper method to get the blender scene the object is in - def get_scene(self): - return self.pointer_parent.get_scene() - - # helper method to get the blender object that is currently being exported - def get_object(self): - return self.pointer_datablock - - def get_mesh(self): - return self.pointer_datablock.data + self.close_archive() class ExportParticles(ExporterArchive): commit ebfa6d50060308a2567397e6055aa378440ca4c0 Author: Jeff Doyle (nfz) <she...@ea...> Date: Sun Apr 24 01:24:08 2011 -0300 Bug Fix: scene and preview ribs no longer overwrite each other. Wrong indentation level of source code was causing scene and preview ribs to overwrite each other. This fixes #5 issue on github repo: http://github.com/nfz/RIBMosaic-exp/issues/5 diff --git a/render_ribmosaic/rm_context.py b/render_ribmosaic/rm_context.py index 40b1cb6..3b491db 100644 --- a/render_ribmosaic/rm_context.py +++ b/render_ribmosaic/rm_context.py @@ -239,13 +239,13 @@ class ExportContext(): self.pass_ribstr = getattr(p, "pass_rib_string", self.pass_ribstr) - self._set_pointer_datablock(pointer_datablock) + self._set_pointer_datablock(pointer_datablock) def _set_pointer_datablock(self, pointer_datablock=None): if pointer_datablock: self.pointer_datablock = pointer_datablock self.data_name = getattr(pointer_datablock, "name", "") - self.data_type = getattr(pointer_datablock, "type", "") + self.data_type = getattr(pointer_datablock, "type", self.data_type) def _public_attrs(self, *include): """Returns list of public attributes plus any defined in include""" commit bf9be263b151fdcdb013008cedda66ec65ac52f2 Author: Jeff Doyle (nfz) <she...@ea...> Date: Sun Apr 24 01:19:03 2011 -0300 Preview Enhancement: Increased samples and decreased shading rate to improve preview image quality without increasing render time too much. diff --git a/render_ribmosaic/rm_property.py b/render_ribmosaic/rm_property.py index 7d535b2..2ecf1a6 100644 --- a/render_ribmosaic/rm_property.py +++ b/render_ribmosaic/rm_property.py @@ -791,7 +791,7 @@ def create_props(): bpy.types.WindowManager.ribmosaic_preview_samples = bpy.props.IntProperty( name="Samples", description="Preview samples quality", - default=1, + default=2, min=1, max=1024, soft_min=1, @@ -802,7 +802,7 @@ def create_props(): name="Shading", description="Preview shading rate quality", precision=3, - default=4.0, + default=2.0, min=0.001, max=1024.0, soft_min=0.001, ----------------------------------------------------------------------- Summary of changes: render_ribmosaic/rm_context.py | 4 +- render_ribmosaic/rm_export.py | 129 ++++++++++++++++++++++++++++++-------- render_ribmosaic/rm_property.py | 4 +- 3 files changed, 106 insertions(+), 31 deletions(-) hooks/post-receive -- RIBMosaic Experimental |