forked from youen/assembly_handbook
Added possibility to hide specific objects in the rasterized image
This commit is contained in:
parent
a8e10a2b99
commit
ec97d10a51
@ -74,6 +74,7 @@ class AHB_New_Step:
|
||||
view.CoarseView = True
|
||||
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
|
||||
view.addProperty("App::PropertyBool", "Assembly_handbook_RasterView", "Assembly_handbook")
|
||||
view.addProperty("App::PropertyXLinkList", "Assembly_handbook_HideParts", "Assembly_handbook")
|
||||
view.Assembly_handbook_RasterView = raster_view
|
||||
if raster_view:
|
||||
view.Visibility = False
|
||||
|
@ -132,6 +132,11 @@ class RasterView:
|
||||
prev_parts = []
|
||||
new_parts = []
|
||||
all_parts = view.XSource + view.Source
|
||||
|
||||
objects_to_hide = []
|
||||
if 'Assembly_handbook_HideParts' in view.PropertiesList:
|
||||
objects_to_hide = self._flatten_objects_tree(view.Assembly_handbook_HideParts)
|
||||
|
||||
for part in all_parts:
|
||||
link = tmp_doc.addObject('App::Link', part.Name)
|
||||
link.Label = part.Label
|
||||
@ -185,7 +190,7 @@ class RasterView:
|
||||
if obj in objects_to_reset.keys():
|
||||
continue
|
||||
|
||||
if self._should_render(obj):
|
||||
if self._should_render(obj) and not obj in objects_to_hide:
|
||||
if not fast_render:
|
||||
objects_to_reset[obj] = (
|
||||
obj.ViewObject.Visibility,
|
||||
@ -285,7 +290,7 @@ class RasterView:
|
||||
# restore properties on objects we have modified
|
||||
for obj, props in objects_to_reset.items():
|
||||
obj.ViewObject.Visibility = props[0]
|
||||
if self._should_render(obj):
|
||||
if self._should_render(obj) and not obj in objects_to_hide:
|
||||
obj.ViewObject.LineColor = props[1]
|
||||
obj.ViewObject.ShapeMaterial.AmbientColor = props[2]
|
||||
obj.ViewObject.ShapeMaterial.DiffuseColor = props[3]
|
||||
|
Loading…
Reference in New Issue
Block a user