Hi James,

I released a fix to the chrono_import.py Blender add-on, just 5 minutes ago.

- now you should be able to install and enable it without the "restricted content" error

- once installed there is the button that opens the browser to the documentation of the add-on on Projectchrono.org

- the "bpy.context.scene.render.use_lock_interface = True"  trick cannot be invoked at the add-on registration (again, the "restricted content" limitation), so I just moved it in the code that is called all times some simulation is load from disk. This should turn on the lock interface even more than needed, but this workaround is sufficient to avoid troubles.

NOTE: the new release is not in the main branch: currently you can find it in the features/geometry  branch, because I was in that context when I pushed the commit.  It will be merged with the main branch soon, anyway.

A.

On 05/05/2023 21:46, James Baxter wrote:
Hi Alessandro,

I believe that was the issue. Earlier I mentioned that I had to move that line due to an error it was giving me with the most recent version of Blender.

"""
1. When enabling the Chrono importer add-on in blender, I received this error: https://archive.blender.org/wiki/index.php/Extensions:2.6/Py/API_Changes/#Restricted_Context. I was able to work past it by moving the following lines from register() to execute():
        # this is needed to avoid crashes when pressing F12 for rendering
        bpy.context.scene.render.use_lock_interface = True

        bpy.context.scene.ch_meshsetting_index = -1
        bpy.context.scene.ch_meshsetting.clear()

        bpy.context.scene.ch_glyph_setting_index = -1
        bpy.context.scene.ch_glyph_setting.clear()

I am very confident that was not the proper fix to the issue, but it prevented me from receiving the error.
"""

-James

On Thursday, May 4, 2023 at 5:07:16 PM UTC-4 [email protected] wrote:

    Hi James,

    I got the same problem (crashing when rendering animations) but I
    fixed it by turning ON the "lock interface" feature.

    Please check the menu  Render/Lock Interface: is it turned on or
    off? By default it is off.

    Anyway, In line 1964 of chrono_import.py I added

        # this is needed to avoid crashes when pressing F12 for rendering
        bpy.context.scene.render.use_lock_interface = True

    and this means that the lock interface feature should be already
    turned ON as soon as you register the plugin...

    This said, maybe the crash is caused by something else.

    Let me know

    Alessandro


    On 04/05/2023 18:43, James Baxter wrote:
    Hi Alessandro,

    Unfortunately, Blender is crashing for me when I try to render
    these scenes. I've attached the log for when I render the demo
    simulation.

    It was able to render the first couple frames (saving to a series
    of images, not a direct video file) before crashing. My
    computer's total RAM usage stayed well below 100% the entire
    time. This is with all renderers (cycles, evee, workbench), and I
    have checked that I can render simple animations (a manually
    keyframed box that jumped around a bit) without crashing. I also
    ran the blender benchmarker and it didn't seem to have any problems.

    Therefore, I believe the issue is caused by the chrono_import
    tool, not by inadequate hardware or a bad installation. Please
    let me know your thoughts.

    Thanks,
    James
    On Wednesday, May 3, 2023 at 4:32:36 PM UTC-4 [email protected]
    wrote:

        Hi James,

        Hi Alessandro,

        I tried with out with a vehicle simulation with good
        success. One more bug though and a question:

        3. After clicking File -> New and using the chrono_import
        option I get this error. Closing and re-opening Blender
        resolves it. [...]
        I will look at it when I find some spare time. Thanks for
        reporting bugs.

        However, to confirm, it appears that if I click
        chrono_import (after having already imported a simulation),
        it will clear the previous data as it loads the new? I do
        not need to fully close and re-launch the program to ensure
        it is using the new data?

        Yes, all times you perform the chrono_import menu, it clears
        the previous data and loads the new data.

        Few caveats, anyway: it is not 100% sure that there will be
        "leftovers" at each call to chrono_import... to be on the
        safe side, you might run the Blender menus under 
        File/Cleanup/... that remove orphan objects that are not
        referenced anymore.

        Also, here when I want to be completely sure to start from
        scratch, I really close and restart Blender.


        Also, with my vehicle simulation (15 bodies in
        chrono_assets, none in chrono_frame_assets), I only get 5
        FPS during playback. I expected it to be higher since I
        eliminated exporting bodies that change each frame (like
        springs) and used only bodies that need a new position /
        rotation. Is this expected behavior due to the CPU-bound
        task of instantiating / uninstantiating objects each frame?

        Yes, this is the expected performance caused by Blender
        instantiating/uninstantiating objects, even if the adoption
        of non-mutable assets should make things speedier. I think
        that until it drops to 1 fps, it is still acceptable as
        Blender is used for hi quality renderings, rather then for
        interactive viewing. The problem is when it becomes even
        slower, so also the GUI of Blender starts to act as
        "freezing" and it becomes not so manageable.

        best regards

        Alessandro



        Thanks,
        James


        On Tuesday, May 2, 2023 at 9:21:41 PM UTC-4 James Baxter wrote:

            Hi Alessandro,

            I have been trying this out today, and am very excited!
            It is going to be really something to take vehicle
            simulations from Chrono and render them with photo-realism.

            I did have a few comments about bugs I ran into:
            1. When enabling the Chrono importer add-on in blender,
            I received this error:
            
https://archive.blender.org/wiki/index.php/Extensions:2.6/Py/API_Changes/#Restricted_Context.
            I was able to work past it by moving the following lines
            from register() to execute():
                    # this is needed to avoid crashes when pressing
            F12 for rendering
            bpy.context.scene.render.use_lock_interface = True

            bpy.context.scene.ch_meshsetting_index = -1
            bpy.context.scene.ch_meshsetting.clear()

            bpy.context.scene.ch_glyph_setting_index = -1
            bpy.context.scene.ch_glyph_setting.clear()

            I am very confident that was not the proper fix to the
            issue, but it prevented me from receiving the error. I
            had gotten the error with both Blender 3.5.1 and 3.4.1
            on Windows. This allowed me to use it on 3.5.1. I did
            not try hitting F12

            2: When running demo_POST_blender1.cpp, it crashed due
            to line 301 in ChBlender.cpp:
            std::string abspath_pic_output =
            filesystem::path(base_path + pic_path + "/" +
            pic_filename + "_######").make_absolute().str();

            I am running Chrono on Ubuntu, and it seems the
            filesystem::path::make_absolute() method requires the
            file to actually exist; I'm not sure if it is different
            on Windows. I was able to resolve the problem by
            creating the directory (anim/photo_######) manually.

            Thanks again for releasing these updates; I'll let you
            know if I run into more issues when I try using them
            with my own vehicle simulations.

            James



            On Friday, April 28, 2023 at 7:17:38 PM UTC-4
            [email protected] wrote:

                Hi James,

                I just sent my latest commits to GIThub containing
                the documentation (a sketch of it, I mean) for the
                Blender add-on.

                If things go as expected, the CI system will trigger
                a Doxygen rebuild that will turn into an updated
                documentation at
                https://api.projectchrono.org/development/ , where
                you should find a new link to Chrono::Blender, one
                row below the Chrono::Solidworks link.

                Now it is too late in the night for waiting the CI
                to finish, and I must sleep, tomorrow I will see if
                all was ok or the Doxygen pipeline had troubles.

                regards

                Alessandro

                On 28/04/2023 19:47, James Baxter wrote:
                Hi Alessandro,

                I will plan to begin working on this on Monday,
                have you been able to write any documentation? The
                page I linked earlier still appears to be empty.

                Thanks,
                James

                On Wednesday, April 19, 2023 at 8:18:40 AM UTC-4
                James Baxter wrote:

                    Alessandro,

                    Thank you; I will plan to try out your
                    documentation and code late next week and will
                    be happy to provide feedback.

                    James

                    On Wednesday, April 19, 2023 at 2:40:08 AM
                    UTC-4 [email protected] wrote:

                        Hi James

                        You are right, there is a Blender pipeline
                        under development that could do what you
                        need, and I am in charge of it.

                        I was going to write the documentation
                        about how to install and use the Blender
                        add-in but I've been postponing it for two
                        months.

                        I hope to write at least some basic
                        guidelines in the next days.

                        Best regards

                        Alessandro Tasora

                        Il mar 18 apr 2023, 15:31 James Baxter
                        <[email protected]> ha scritto:

                            Hello, I am looking to render some
                            vehicle simulations I have made, and I
                            am finding the built in Irrlicht
                            renderer difficult to use and lacking
                            some features I need (textures don't
                            apply properly to things that aren't
                            geometry primitives, exported frames
                            are all black), so I'm thinking setting
                            up a pipeline to a different rendering
                            tool makes more sense.

                            I see that there is some work done on a
                            pipeline for blender, but I'm having
                            trouble finding any documentation. This
                            page appears to be empty:
                            
https://api.projectchrono.org/development/blender_visualization.html

                            *In general, is there a specific tool
                            that you'd recommend as the lowest
                            resistance path to being able to render
                            vehicle simulations with full control
                            over textures, lighting, etc; and is
                            there any code / documentation you can
                            point me to?*

                            I have found the following, but would
                            like to make sure I'm starting in the
                            right place so I don't reinvent the wheel
                            
https://github.com/projectchrono/chrono/blob/main/src/demos/postprocess/demo_POST_blender1.cpp
                            
https://github.com/projectchrono/chrono/tree/main/src/demos/tools/blender_py

                            Thanks,
                            James

-- You received this message because you
                            are subscribed to the Google Groups
                            "ProjectChrono" group.
                            To unsubscribe from this group and stop
                            receiving emails from it, send an email
                            to [email protected].
                            To view this discussion on the web
                            visit
                            
https://groups.google.com/d/msgid/projectchrono/982b90cb-6381-4ed7-ba59-f39d7fbdaf7bn%40googlegroups.com
                            
<https://groups.google.com/d/msgid/projectchrono/982b90cb-6381-4ed7-ba59-f39d7fbdaf7bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- You received this message because you are
                subscribed to the Google Groups "ProjectChrono" group.
                To unsubscribe from this group and stop receiving
                emails from it, send an email to
                [email protected].
                To view this discussion on the web visit
                
https://groups.google.com/d/msgid/projectchrono/c4520222-3896-4c37-9df7-96c8657ed7e8n%40googlegroups.com
                
<https://groups.google.com/d/msgid/projectchrono/c4520222-3896-4c37-9df7-96c8657ed7e8n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- You received this message because you are subscribed to the
        Google Groups "ProjectChrono" group.
        To unsubscribe from this group and stop receiving emails
        from it, send an email to [email protected].
        To view this discussion on the web visit
        
https://groups.google.com/d/msgid/projectchrono/046cade2-5ecf-498f-9b29-1b596b1c1099n%40googlegroups.com
        
<https://groups.google.com/d/msgid/projectchrono/046cade2-5ecf-498f-9b29-1b596b1c1099n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- You received this message because you are subscribed to the
    Google Groups "ProjectChrono" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected].
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/projectchrono/67352218-eec0-4932-82a8-b723c335954dn%40googlegroups.com
    
<https://groups.google.com/d/msgid/projectchrono/67352218-eec0-4932-82a8-b723c335954dn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/6eae38cd-da8c-46bb-a56e-231ac4ef84d0n%40googlegroups.com <https://groups.google.com/d/msgid/projectchrono/6eae38cd-da8c-46bb-a56e-231ac4ef84d0n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/b82e90c6-35d8-b488-2689-6615f6a365cd%40ied.unipr.it.

Reply via email to