Skip to content

Commit

Permalink
Revised the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
3DSinghVFX committed Dec 12, 2023
1 parent 188f55f commit 040aa31
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 25 deletions.
2 changes: 1 addition & 1 deletion animation_nodes/data_structures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def importDataStructures():
from . virtual_list.virtual_clists import (
VirtualVector3DList, VirtualMatrix4x4List, VirtualEulerList, VirtualBooleanList,
VirtualFloatList, VirtualDoubleList, VirtualLongList, VirtualColorList,
VirtualVector2DList, VirtualQuaternionList
VirtualVector2DList, VirtualQuaternionList, VirtualInt2List
)

from . splines.base_spline import Spline
Expand Down
12 changes: 2 additions & 10 deletions animation_nodes/nodes/mesh/insert_custom_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from ... base_types import AnimationNode, VectorizedSocket
from ... data_structures import (
Color,
LongList,
FloatList,
Attribute,
AttributeType,
AttributeDomain,
VirtualInt2List,
VirtualLongList,
VirtualColorList,
AttributeDataType,
Expand Down Expand Up @@ -97,15 +97,7 @@ def execute(self, mesh, customAttributeName, data):
if self.dataType == "INT":
_data = VirtualLongList.create(data, 0).materialize(amount)
elif self.dataType == "INT32_2D":
if self.useDataList:
indices1 = LongList.fromValues(data.asNumpyArray()[::2])
indices2 = LongList.fromValues(data.asNumpyArray()[1::2])
else:
indices1 = LongList.fromValues([data[0]])
indices2 = LongList.fromValues([data[1]])
_indices1 = VirtualLongList.create(indices1, 0)
_indices2 = VirtualLongList.create(indices2, 0)
_data = createEdgeIndices(amount, _indices1, _indices2)
_data = VirtualInt2List.create(data, (0, 0)).materialize(amount)
elif self.dataType == "FLOAT":
_data = FloatList.fromValues(VirtualDoubleList.create(data, 0).materialize(amount))
elif self.dataType == "FLOAT2":
Expand Down
14 changes: 2 additions & 12 deletions animation_nodes/nodes/mesh/set_custom_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from ... base_types import AnimationNode, VectorizedSocket
from ... data_structures import (
Color,
LongList,
FloatList,
VirtualPyList,
VirtualInt2List,
VirtualLongList,
VirtualColorList,
VirtualDoubleList,
Expand Down Expand Up @@ -102,16 +101,7 @@ def execute(self, object, customAttributeName, data):
if self.dataType == "INT":
_data = VirtualLongList.create(data, 0).materialize(amount)
elif self.dataType == "INT32_2D":
if self.useDataList:
indices1 = LongList.fromValues(data.asNumpyArray()[::2])
indices2 = LongList.fromValues(data.asNumpyArray()[1::2])
else:
indices1 = LongList.fromValues([data[0]])
indices2 = LongList.fromValues([data[1]])
_indices1 = VirtualLongList.create(indices1, 0)
_indices2 = VirtualLongList.create(indices2, 0)
_data = createEdgeIndices(amount, _indices1, _indices2)
_data = createEdgeIndices(amount, _indices1, _indices2)
_data = VirtualInt2List.create(data, (0, 0)).materialize(amount)
elif self.dataType == "FLOAT":
_data = FloatList.fromValues(VirtualDoubleList.create(data, 0).materialize(amount))
elif attribute.data_type == "FLOAT2":
Expand Down
4 changes: 2 additions & 2 deletions animation_nodes/sockets/int2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Int2Socket(bpy.types.NodeSocket, AnimationNodeSocket):
bl_idname = "an_Int2Socket"
bl_label = "Int2 Socket"
dataType = "Int2"
drawColor = (0.625, 0.7, 1.0, 1)
drawColor = (0.35, 0.7, 1.0, 1)
comparable = True
storable = True

Expand All @@ -34,7 +34,7 @@ class Int2ListSocket(bpy.types.NodeSocket, CListSocket):
bl_label = "Int2 List Socket"
dataType = "Int2 List"
baseType = Int2Socket
drawColor = (0.625, 0.7, 1.0, 0.5)
drawColor = (0.35, 0.7, 1.0, 0.5)
storable = True
comparable = False
listClass = Int2List
Expand Down

0 comments on commit 040aa31

Please sign in to comment.