@@ -57,10 +57,15 @@ def __init__(self, socket: bpy.types.NodeSocket = None, value = None):
57
57
self .socket_type = type (socket ).__name__
58
58
59
59
def _math (self , other , operation , reverse = False ):
60
+ if other is None :
61
+ vector_or_value = self
62
+ else :
63
+ vector_or_value = (other , self ) if reverse else (self , other )
64
+
60
65
if self ._socket .type == 'VECTOR' :
61
- return geometry_script .vector_math (operation = operation , vector = ( other , self ) if reverse else ( self , other ) )
66
+ return geometry_script .vector_math (operation = operation , vector = vector_or_value )
62
67
else :
63
- return geometry_script .math (operation = operation , value = ( other , self ) if reverse else ( self , other ) )
68
+ return geometry_script .math (operation = operation , value = vector_or_value )
64
69
65
70
def __add__ (self , other ):
66
71
return self ._math (other , 'ADD' )
@@ -92,6 +97,36 @@ def __mod__(self, other):
92
97
def __rmod__ (self , other ):
93
98
return self ._math (other , 'MODULO' , True )
94
99
100
+ def __floordiv__ (self , other ):
101
+ return self ._math (other , 'DIVIDE' )._math (None ,'FLOOR' )
102
+
103
+ def __rfloordiv__ (self , other ):
104
+ return self ._math (other , 'DIVIDE' ,True )._math (None ,'FLOOR' )
105
+
106
+ def __pow__ (self , other ):
107
+ return self ._math (other , 'POWER' )
108
+
109
+ def __rpow__ (self , other ):
110
+ return self ._math (other , 'POWER' , True )
111
+
112
+ def __matmul__ (self , other ):
113
+ return self ._math (other , 'DOT_PRODUCT' )
114
+
115
+ def __rmatmul__ (self , other ):
116
+ return self ._math (other , 'DOT_PRODUCT' , True )
117
+
118
+ def __abs__ (self ):
119
+ return self ._math (None ,'ABSOLUTE' )
120
+
121
+ def __neg__ (self ):
122
+ return self ._math (- 1 , 'MULTIPLY' )
123
+
124
+ def __pos__ (self ):
125
+ return self
126
+
127
+ def __round__ (self ):
128
+ return self ._math (None ,'ROUND' )
129
+
95
130
def _compare (self , other , operation ):
96
131
return geometry_script .compare (operation = operation , a = self , b = other )
97
132
0 commit comments