stabilizing

This commit is contained in:
nek0 2016-12-29 20:15:09 +01:00
parent 84b1a86f22
commit 18f61d37af
2 changed files with 17 additions and 16 deletions

View file

@ -46,7 +46,7 @@ drawRect node color Fill rect@GeglRectangle{..} buf = do
, G.Property "color" $ G.PropertyColor color , G.Property "color" $ G.PropertyColor color
] ]
diw <- liftIO $ G.gegl_node_connect_to opNode "output" node "input" diw <- liftIO $ G.gegl_node_connect_to opNode "output" node "input"
unless diw $ error "Affection.Draw.drawRect': connect failed" unless diw $ error "Affection.Draw.drawRect: connect failed"
put $ ad put $ ad
{ drawStack = (DrawRequest rect buf (Kill (Just tempRoot))) : drawStack ad { drawStack = (DrawRequest rect buf (Kill (Just tempRoot))) : drawStack ad
} }

View file

@ -39,21 +39,21 @@ updateParticle time funct pa = do
now <- elapsedTime <$> get now <- elapsedTime <$> get
if particleCreation pa + particleTimeToLive pa < now if particleCreation pa + particleTimeToLive pa < now
then do then do
mproducer <- liftIO $ G.gegl_node_get_producer -- mproducer <- liftIO $ G.gegl_node_get_producer
(particleStackCont pa) -- (particleStackCont pa)
"input" -- "input"
case mproducer of -- case mproducer of
Just (producer, padname) -> do -- Just (producer, padname) -> do
consumers <- liftIO $ G.gegl_node_get_consumers -- consumers <- liftIO $ G.gegl_node_get_consumers
(particleStackCont pa) -- (particleStackCont pa)
"output" -- "output"
liftIO $ mapM_ (\(node, inpad)-> G.gegl_node_connect_to -- liftIO $ mapM_ (\(node, inpad)-> G.gegl_node_connect_to
producer -- producer
padname -- padname
node -- node
inpad -- inpad
) consumers -- ) consumers
Nothing -> return () -- Nothing -> return ()
liftIO $ G.gegl_node_drop $ particleRootNode pa liftIO $ G.gegl_node_drop $ particleRootNode pa
return $ Nothing return $ Nothing
else do else do
@ -119,6 +119,7 @@ updateParticleSystem sys sec upd draw = do
x <- catMaybes <$> mapM (updateParticle sec upd) (partStorList $ partSysParts sys) x <- catMaybes <$> mapM (updateParticle sec upd) (partStorList $ partSysParts sys)
-- x <- catMaybes <$> foldM (updateParticle sec upd) [] (reverse $ psParts sys) -- x <- catMaybes <$> foldM (updateParticle sec upd) [] (reverse $ psParts sys)
when (not $ null x) $ do when (not $ null x) $ do
liftIO $ G.gegl_node_link_many $ map particleStackCont (partStorList $ partSysParts sys)
-- liftIO $ traceIO "linking last node to output" -- liftIO $ traceIO "linking last node to output"
liftIO $ G.gegl_node_link (particleStackCont $ last x) (partSysNode sys) liftIO $ G.gegl_node_link (particleStackCont $ last x) (partSysNode sys)
mapM_ (draw (partSysBuffer sys) (partSysNode sys)) x mapM_ (draw (partSysBuffer sys) (partSysNode sys)) x