Git Product home page Git Product logo

Comments (6)

OmarEmaraDev avatar OmarEmaraDev commented on June 25, 2024

The Time Info node just returns the value of self.nodeTree.scene.frame_current_final, so you can use that. Or are you talking about something different?

from animation_nodes.

derekcbr avatar derekcbr commented on June 25, 2024

nodeTree.scene.frame_current_final

Hi Omar:
According to your previous posts, I changed cython coding to generate below:
myfalloff = my_wiggle_falloff.WiggleFalloffNode.execute(my_wiggle_falloff.WiggleFalloffNode, 0, 100.0, 1.0, 0.5, 0.5, 2, 0.3)
myoffset = (0, 0, 1)
myoffsetvectornodecls = my_offset_vector.OffsetVectorNode()
myvectors = myoffsetvectornodecls.execute_List(vertexLocations, myfalloff, myoffset)

I just have no idea how to link self.nodeTree.scene.frame_current_final with evolution in myfalloff.
I tried to add animation but failed:
for i in range(50):
context.scene.frame_set(i)
frame = scene.frame_current_final
outmesh = bpy.data.meshes.new(name="Target")
myobj = bpy.data.objects.new("Target", outmesh)
bpy.context.collection.objects.link(myobj)
..get meshData and setMesh(outmesh, meshData, myobj)
And then in the loop, I generated 50 Target objects, but no animation.

Thank you for the help!

from animation_nodes.

OmarEmaraDev avatar OmarEmaraDev commented on June 25, 2024

evolution is the third argument to the WiggleFalloffNode.execute function, so passing the frame number instead of 100 in your example should be what you need. Though this seems rather hacky, that is, to execute the nodes manually, so not sure if it is worth doing it that way.

from animation_nodes.

derekcbr avatar derekcbr commented on June 25, 2024

context.scene.frame_set(i)
frame = scene.frame_current_final

Thanks Omar for the reply. No real use indeed just for testing Cython.

for i in range(50):
        scene.frame_set(i)
        frame = scene.frame_current_final
        myfalloff = my_wiggle_falloff.WiggleFalloffNode.execute(my_wiggle_falloff.WiggleFalloffNode, 0, i, 1.0, 0.5, 0.5, 2, 0.3)
        myoffset = (0, 0, 1)
        myoffsetvectornodecls = my_offset_vector.OffsetVectorNode()
        myvectors = myoffsetvectornodecls.execute_List(vertexLocations, myfalloff, myoffset)
        
        try:
            meshData = Mesh(myvectors, edgeIndices, polygonIndices, skipValidation = skipValidation)
            if len(materialIndices) == len(polygonIndices) and materialIndices.getMinValue() >= 0:
                meshData.insertBuiltInAttribute(Attribute("Material Indices", AttributeType.MATERIAL_INDEX, AttributeDomain.FACE, AttributeDataType.INT, materialIndices))
            else:
                print("Invalid material indices.")
            
        except Exception as e:
            print(str(e))
        
        print(meshData)
        outmesh = bpy.data.meshes.new(name="Target")
        myobj = bpy.data.objects.new("Target", outmesh)
        bpy.context.collection.objects.link(myobj)
       
        meshDataType = "MESH_DATA"
        if meshDataType == "MESH_DATA":
            setMesh(outmesh, meshData, myobj)
        elif meshDataType == "BMESH":
            setBMesh(outmesh, bm)
        elif meshDataType == "VERTICES":
            setVertices(outmesh, meshData.vertices)

But I failed to generate animation but got 50 Target Objects instead.
In mesh_object_output.py.py, I noticed that animation is built by below, but no idea how to proceed?

if not isAnimated(mesh):
mesh['an_helper_property'] = 0
mesh.keyframe_insert(data_path = '["an_helper_property"]')

from animation_nodes.

OmarEmaraDev avatar OmarEmaraDev commented on June 25, 2024

To clarify, do you actually want an animated mesh? In that case, this will not work, and the creation of multiple meshes is expected. Animation Nodes is able to animate meshes because it executes on frame changes and adjusts the mesh directly instead of creating a new one.

from animation_nodes.

derekcbr avatar derekcbr commented on June 25, 2024

To clarify, do you actually want an animated mesh? In that case, this will not work, and the creation of multiple meshes is expected. Animation Nodes is able to animate meshes because it executes on frame changes and adjusts the mesh directly instead of creating a new one.

Got it! Thanks!

from animation_nodes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.