Skip to content

Commit

Permalink
Changed load_post (typo probably -> was pre_render in if statement
Browse files Browse the repository at this point in the history
SyncPipline (load_callback function is now persistent such that blender does not flush this handler when load new file)
Unregister removes the callback

-> Why does loading the .blend file somehow set up the pipeline which was used for this file correctly but does not include shaders pinned to materials)
-> Fix this?
  • Loading branch information
Gabriel Nützi (UBUNTU) committed May 22, 2015
1 parent a26f61d commit 8bcda4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion render_ribmosaic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def register():
RibmosaicInfo("ribify module not found, using script level exporter")

bpy.utils.register_module(__name__)
#bpy.ops.wm.ribmosaic_modal_sync()
#bpy.ops.wm.ribmosaic_pipeline_sync()


def unregister():
Expand Down
12 changes: 6 additions & 6 deletions render_ribmosaic/rm_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2614,12 +2614,12 @@ def _ribify_cache(self, material_idx=0):
# for unused materials
if ("PointsPolygons" in firstLine):
# List all faces using current material
solids = [f for f in self.mesh_exportdata.faces if \
f.material_index == material_idx]
solids = [p for p in self.mesh_exportdata.polygons if \
p.material_index == material_idx]
# make a List of used face indices
faces = [f.index for f in solids]
faces = [p.index for p in solids]
# Find highest used vert index
lastV = max([v for f in solids for v in f.vertices])
lastV = max([v for p in solids for v in p.vertices])
tagMode = 0
perFace = 0
fIndex = 0
Expand Down Expand Up @@ -2654,8 +2654,8 @@ def _ribify_cache(self, material_idx=0):
# If geometry is SDS then insert hole tags to disable faces
# for unused materials
elif ("SubdivisionMesh" in firstLine):
holes = [f.index for f in self.mesh_exportdata.faces if \
f.material_index != material_idx]
holes = [p.index for p in self.mesh_exportdata.polygons if \
p.material_index != material_idx]
tagMode = 0
for l in self._pointer_cache:
if (tagMode == 3):
Expand Down
5 changes: 4 additions & 1 deletion render_ribmosaic/rm_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,8 @@ def invoke(self, context, event):
# #############################################################################
# PIPELINE OPERATORS
# #############################################################################
from bpy.app.handlers import persistent
@persistent
def load_callback(data):
print("load callback")
bpy.ops.wm.ribmosaic_pipeline_sync()
Expand All @@ -1260,7 +1262,8 @@ def execute(self, context):
print("wm.ribmosaic_pipeline_sync()")
# FIXME : load_post handlers never get executed because blender
# clears them on file load
if not load_callback in bpy.app.handlers.render_pre:
# make
if not load_callback in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.append(load_callback)

# Sync pipeline tree with current .rmp files
Expand Down

0 comments on commit 8bcda4e

Please sign in to comment.