@ -89,7 +89,7 @@ class RasterView:
result . extend ( self . _flatten_objects_tree ( [ obj . LinkedObject ] ) )
elif obj . TypeId in [ ' App::Part ' , ' App::DocumentObjectGroup ' ] :
result . extend ( self . _flatten_objects_tree ( obj . Group ) )
elif obj . TypeId in [ ' Part::Feature ' , ' Part::FeaturePython ' , ' PartDesign::Body ' , ' PartDesign::CoordinateSystem ' , ' PartDesign::Line ' , ' Part::Mirroring ' , ' Part::Cut ' , ' Part::Part2DObjectPython ' ] :
elif self . _should_render ( obj ) or self . _should_render_as_is ( obj ) or obj . TypeId in [ ' PartDesign::CoordinateSystem ' , ' PartDesign::Line ' ] :
result . append ( obj )
if hasattr ( obj , ' Group ' ) :
result . extend ( self . _flatten_objects_tree ( obj . Group ) )
@ -97,7 +97,10 @@ class RasterView:
return result
def _should_render ( self , obj ) :
return obj . TypeId in [ ' Part::Feature ' , ' Part::FeaturePython ' , ' PartDesign::Body ' , ' Part::Mirroring ' , ' Part::Cut ' , ' Part::Part2DObjectPython ' ]
return obj . TypeId in [ ' Part::Feature ' , ' Part::FeaturePython ' , ' PartDesign::Body ' , ' Part::Mirroring ' , ' Part::Cut ' , ' Part::Part2DObjectPython ' , ' Part::MultiFuse ' , ' Part::Loft ' , ' Part::Torus ' , ' Part::Cylinder ' ]
def _should_render_as_is ( self , obj ) :
return obj . TypeId in [ ' App::FeaturePython ' ]
def render ( self , fast_render = True ) :
from pivy import coin
@ -128,7 +131,8 @@ class RasterView:
sceneGroup = tmp_doc . addObject ( ' App::DocumentObjectGroup ' , ' Scene ' )
prev_parts = [ ]
new_parts = [ ]
for part in view . XSource :
all_parts = view . XSource + view . Source
for part in all_parts :
link = tmp_doc . addObject ( ' App::Link ' , part . Name )
link . Label = part . Label
if part . TypeId == ' App::Link ' :
@ -139,10 +143,14 @@ class RasterView:
link . Placement = part . Placement
else :
link . LinkedObject = part
if part . TypeId in [ ' Part::Part2DObjectPython ' ] :
link . Placement = part . Placement
is_new_part = workbench . techDrawExtensions . isNewPartInView ( view , part )
if not fast_render :
# check if another part with different render settings will conflict with ours
# a conflict occurs when two parts link to the same object (directly or indirectly), because render settings (such as color) are set at the object level
is_conflicting = False
if link . LinkedObject in duplicated_parts . keys ( ) :
link . LinkedObject = duplicated_parts [ link . LinkedObject ]
@ -189,6 +197,12 @@ class RasterView:
obj . ViewObject . LineWidth ,
obj . ViewObject . DisplayMode
)
if not obj . ViewObject . Visibility :
obj . ViewObject . ShapeMaterial . AmbientColor = ( 0 , 0 , 0 )
obj . ViewObject . ShapeMaterial . DiffuseColor = ( 0 , 0 , 0 )
obj . ViewObject . ShapeMaterial . SpecularColor = ( 0 , 0 , 0 )
obj . ViewObject . ShapeMaterial . EmissiveColor = ( 0 , 0 , 0 )
else :
objects_to_reset [ obj ] = (
obj . ViewObject . Visibility ,
@ -267,6 +281,7 @@ class RasterView:
composite_img = composite_img . quantize ( colors = num_colors , dither = Image . Dither . NONE )
finally :
#raise Exception("test")
# restore properties on objects we have modified
for obj , props in objects_to_reset . items ( ) :
obj . ViewObject . Visibility = props [ 0 ]