Results 1 to 10 of 10

Thread: [suggestion] generate many objects all at once

  1. #1
    Member imdjs's Avatar
    Join Date
    Mar 2013
    Location
    china
    Posts
    243

    [suggestion] generate many objects all at once

    hi
    I'm writing an addon call "green_land" which will generate many objects all at once(more than 10000) but now the bpy api only can generate one object at a time,so It's very slow to generate 10000 objects using the for i in range(10000): way to do that. can we have an api that can generates many objects all at once?
    Last edited by imdjs; 13-Jul-17 at 09:43.



  2. #2
    Nice 3D models = 25 % K.I.S.S + 25 % common sense + 25 % Inspiration + 25 % Knowledge
    Win 10 64 bits / Thanks and a Happy 2.79 with Cycles



  3. #3
    Member imdjs's Avatar
    Join Date
    Mar 2013
    Location
    china
    Posts
    243
    @RickyBlender
    thank you for the link,but I do using the copy object and link them to the scene,but still, copy more than 10000 empty object take about 20s it is way too slow compare to the particles generating instance objects speed maybe 100time slower
    Last edited by imdjs; 12-Jul-17 at 19:07.



  4. #4
    might be normal for 10 000
    anything higher then 1000 makes blender sluggish !

    happy bl
    Nice 3D models = 25 % K.I.S.S + 25 % common sense + 25 % Inspiration + 25 % Knowledge
    Win 10 64 bits / Thanks and a Happy 2.79 with Cycles



  5. #5
    Member imdjs's Avatar
    Join Date
    Mar 2013
    Location
    china
    Posts
    243
    I have solved this speed problem ,I using cytpes to copy the object .now It can generate 20000 objects within one second.
    here is the addon to generate 20000 objects,there are two buttons (generate use C++ / generate use py) to compare the speed
    TEST_generate_objects(20000within one sceond).zip
    test_generate_objects(C++ source compile to dll).zip
    here is the comparision of C++ and py speed:
    C


    py:
    Last edited by imdjs; 13-Jul-17 at 09:12.



  6. #6
    nice find here

    is there a thread that explains how this work ?

    I see that it is using a C DLL to get it done
    will have to test that with my own object and time it

    very interesting

    thanks for feedback

    happy bl
    Nice 3D models = 25 % K.I.S.S + 25 % common sense + 25 % Inspiration + 25 % Knowledge
    Win 10 64 bits / Thanks and a Happy 2.79 with Cycles



  7. #7
    Member imdjs's Avatar
    Join Date
    Mar 2013
    Location
    china
    Posts
    243
    Originally Posted by RickyBlender View Post
    nice find here

    is there a thread that explains how this work ?

    I see that it is using a C DLL to get it done
    will have to test that with my own object and time it

    very interesting

    thanks for feedback

    happy bl
    yes,I use C++ code to do that. I have attached the source file here .you can try to complile this cpp file to "test_generate_objects64.dll" as a module being call by python via ctypes.
    test_generate_objects(C++ source compile to dll).zip



  8. #8
    you mean this has to be compile in C
    darn I don't have anything to do that and don't really work with C

    still a good reference for those who can work in C

    thanks anyway
    happy bl
    Nice 3D models = 25 % K.I.S.S + 25 % common sense + 25 % Inspiration + 25 % Knowledge
    Win 10 64 bits / Thanks and a Happy 2.79 with Cycles



  9. #9
    Member imdjs's Avatar
    Join Date
    Mar 2013
    Location
    china
    Posts
    243
    Originally Posted by RickyBlender View Post
    you mean this has to be compile in C
    darn I don't have anything to do that and don't really work with C

    still a good reference for those who can work in C

    thanks anyway
    happy bl
    so,I still think that we should have a python api to do the same job,the C code is not friendly for every one.and this C code still have something wrong.
    Last edited by imdjs; 13-Jul-17 at 09:50.



  10. #10
    we are supposed to get more in 2.8
    but have to wait till we see what we get !

    you could do a script using CUDA python
    but not certain of speed increase !

    happy bl
    Nice 3D models = 25 % K.I.S.S + 25 % common sense + 25 % Inspiration + 25 % Knowledge
    Win 10 64 bits / Thanks and a Happy 2.79 with Cycles



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •