# state file generated using paraview version 6.2.0-RC1
import paraview
paraview.compatibility.major = 6
paraview.compatibility.minor = 2

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------

# Create a new 'Render View'
renderView1 = CreateView('RenderView')
renderView1.Set(
    ViewSize=[1340, 820],
    CenterOfRotation=[0.029999999329447746, -0.00645000021904707, 0.03000000026077032],
    CameraPosition=[-0.034012483369375686, -0.006549716209672378, 0.08109241299981705],
    CameraFocalPoint=[0.029999999329447708, -0.0064500002190470635, 0.030000000260770276],
    CameraViewUp=[-0.5519823218259772, 0.4672396430806204, -0.690653771672535],
)

SetActiveView(None)

# ----------------------------------------------------------------
# setup view layouts
# ----------------------------------------------------------------

# create new layout object 'Layout #1'
layout1 = CreateLayout(name='Layout #1')
layout1.AssignView(0, renderView1)
layout1.SetSize(1340, 820)

# ----------------------------------------------------------------
# restore active view
SetActiveView(renderView1)
# ----------------------------------------------------------------

# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------

# create a new 'XML Unstructured Grid Reader'
config_t90vtu = XMLUnstructuredGridReader(registrationName='config_t90.vtu', FileName=['/home/glow/data/tmp/config_t90.vtu'])
config_t90vtu.Set(
    PointArrayStatus=['Velocity', 'AngularVelocity', 'Radius', 'Quaternion', 'speciesType', 'Id'],
    TimeArray='None',
)

# create a new 'Convert To Point Cloud'
convertToPointCloud1 = ConvertToPointCloud(registrationName='ConvertToPointCloud1', Input=config_t90vtu)

# ----------------------------------------------------------------
# setup the visualization in view 'renderView1'
# ----------------------------------------------------------------

# show data from convertToPointCloud1
convertToPointCloud1Display = Show(convertToPointCloud1, renderView1, 'GeometryRepresentation')

# trace defaults for the display properties.
convertToPointCloud1Display.Set(
    Representation='3D Glyphs',
    ColorArrayName=[None, ''],
    Orient=1,
    OrientationMode='Quaternion',
    SelectOrientationVectors='Quaternion',
    Scaling=1,
    ScaleMode='Magnitude',
    SelectScaleArray='Radius',
    GlyphType='Sphere',
    GlyphTableIndexArray='AngularVelocity',
)

# init the 'Piecewise Function' selected for 'ScaleTransferFunction'
convertToPointCloud1Display.ScaleTransferFunction.Points = [-1.0862400531768799, 0.0, 0.5, 0.0, 5.193759918212891, 1.0, 0.5, 0.0]

# init the 'Piecewise Function' selected for 'OpacityTransferFunction'
convertToPointCloud1Display.OpacityTransferFunction.Points = [-1.0862400531768799, 0.0, 0.5, 0.0, 5.193759918212891, 1.0, 0.5, 0.0]

# ----------------------------------------------------------------
# setup animation scene, tracks and keyframes
# note: the Get..() functions create a new object, if needed
# ----------------------------------------------------------------

# get the time-keeper
timeKeeper1 = GetTimeKeeper()

# initialize the timekeeper

# get time animation track
timeAnimationCue1 = GetTimeTrack()

# initialize the animation track

# get animation scene
animationScene1 = GetAnimationScene()

# initialize the animation scene
animationScene1.Set(
    ViewModules=renderView1,
    Cues=timeAnimationCue1,
    AnimationTime=0.0,
)

# initialize the animation scene

# ----------------------------------------------------------------
# restore active source
SetActiveSource(convertToPointCloud1)
# ----------------------------------------------------------------

# ----------------------------------------------------------------
# setup camera links
# ----------------------------------------------------------------


##--------------------------------------------
## You may need to add some code at the end of this python script depending on your usage, eg:
#
## Render all views to see them appears
# RenderAllViews()
#
## Interact with the view, usefull when running from pvpython
# Interact()
#
## Save a screenshot of the active view
# SaveScreenshot("path/to/screenshot.png")
#
## Save a screenshot of a layout (multiple splitted view)
# SaveScreenshot("path/to/screenshot.png", GetLayout())
#
## Save all "Extractors" from the pipeline browser
# SaveExtracts()
#
## Save a animation of the current active view
# SaveAnimation()
#
## Please refer to the documentation of paraview.simple
## https://www.paraview.org/paraview-docs/nightly/python/
##--------------------------------------------