/
guicommon.py
840 lines (632 loc) · 25.1 KB
/
guicommon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** Joel Palmius, Marc Flerackers
**Copyright(c):** MakeHuman Team 2001-2020
**Licensing:** AGPL3
This file is part of MakeHuman Community (www.makehumancommunity.org).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Abstract
--------
Common GUI elements extracted from gui3d to minimize coupling with gui backend.
"""
import events3d
import numpy as np
import matrix
import material
import collections
class Action(object):
def __init__(self, name):
self.name = name
def do(self):
return True
def undo(self):
return True
# Wrapper around Object3D
class Object(events3d.EventHandler):
"""
An object on the screen.
:param position: The position in 3d space.
:type position: list or tuple
:param mesh: The mesh object.
:param visible: Wether the object should be initially visible.
:type visible: Boolean
"""
def __init__(self, mesh, position=[0.0, 0.0, 0.0], visible=True):
if mesh.object:
raise RuntimeError('This mesh is already attached to an object')
self.mesh = mesh
self.mesh.object = self
self.mesh.setVisibility(visible)
self._material = material.Material(self.name+"_Material") # Render material
self._loc = np.zeros(3, dtype=np.float32)
self._rot = np.zeros(3, dtype=np.float32)
self._scale = np.ones(3, dtype=np.float32)
self.setLoc(*position)
self.lockRotation = False # Set to true to make the rotation of this object independent of the camera rotation
self.placeAtFeet = False # Set to true to automatically set Y loc (position) to height of ground helper joint of the human
self._view = None
self.visible = visible
self.excludeFromProduction = False # Set to true to exclude from production renders
self.proxy = None
self.__seedMesh = self.mesh
self.__proxyMesh = None
self.__subdivisionMesh = None
self.__proxySubdivisionMesh = None
self.setUVMap(mesh.material.uvMap)
def __str__(self):
return "<guicommon.Object %s>" % self.name
# TODO
def clone(self):
raise NotImplementedError("You probably want to do object.mesh.clone()")
def _attach(self):
if self.view.isVisible() and self.visible:
self.mesh.setVisibility(1)
else:
self.mesh.setVisibility(0)
for mesh in self._meshes():
self.attachMesh(mesh)
def _detach(self):
for mesh in self._meshes():
self.detachMesh(mesh)
@staticmethod
def attachMesh(mesh):
import object3d
import selection
selection.selectionColorMap.assignSelectionID(mesh)
object3d.Object3D.attach(mesh)
@staticmethod
def detachMesh(mesh):
import object3d
object3d.Object3D.detach(mesh)
def _meshes(self):
for mesh in (self.__seedMesh,
self.__proxyMesh,
self.__subdivisionMesh,
self.__proxySubdivisionMesh):
if mesh is not None:
yield mesh
@property
def view(self):
if not self._view or not isinstance(self._view, collections.abc.Callable):
return None
return self._view()
def show(self):
self.visible = True
self.setVisibility(True)
def hide(self):
self.visible = False
self.setVisibility(False)
def isVisible(self):
return self.visible
@property
def name(self):
return self.mesh.name
def setVisibility(self, visibility):
if not self.view:
self.mesh.setVisibility(0)
if self.view.isVisible() and self.visible and visibility:
self.mesh.setVisibility(1)
else:
self.mesh.setVisibility(0)
def getPriority(self):
return self.mesh.priority
def setPriority(self, priority):
self.mesh.priority = priority
priority = property(getPriority, setPriority)
##
# Orientation properties
##
def getLoc(self):
result = np.zeros(3, dtype=np.float32)
result[:] = self._loc[:]
if self.placeAtFeet:
from core import G
human = G.app.selectedHuman
result[1] = human.getJointPosition('ground')[1]
return result
def setLoc(self, locx, locy, locz):
"""
This method is used to set the location of the object in the 3D coordinate space of the scene.
:param locx: The x coordinate of the object.
:type locx: float
:param locy: The y coordinate of the object.
:type locy: float
:param locz: The z coordinate of the object.
:type locz: float
"""
self._loc[...] = (locx, locy, locz)
loc = property(getLoc, setLoc)
def get_x(self):
return self.loc[0]
def set_x(self, x):
self._loc[0] = x
x = property(get_x, set_x)
def get_y(self):
return self.loc[1]
def set_y(self, y):
self._loc[1] = y
y = property(get_y, set_y)
def get_z(self):
return self.loc[2]
def set_z(self, z):
self._loc[2] = z
z = property(get_z, set_z)
def get_rx(self):
return self._rot[0]
def set_rx(self, rx):
self._rot[0] = rx
rx = property(get_rx, set_rx)
def get_ry(self):
return self._rot[1]
def set_ry(self, ry):
self._rot[1] = ry
ry = property(get_ry, set_ry)
def get_rz(self):
return self._rot[2]
def set_rz(self, rz):
self._rot[2] = rz
rz = property(get_rz, set_rz)
def get_sx(self):
return self._scale[0]
def set_sx(self, sx):
self._scale[0] = sx
sx = property(get_sx, set_sx)
def get_sy(self):
return self._scale[1]
def set_sy(self, sy):
self._scale[1] = sy
sy = property(get_sy, set_sy)
def get_sz(self):
return self._scale[2]
def set_sz(self, sz):
self._scale[2] = sz
sz = property(get_sz, set_sz)
def getPosition(self):
return [self.x, self.y, self.z]
def setPosition(self, position):
self.setLoc(position[0], position[1], position[2])
def getRotation(self):
return [self.rx, self.ry, self.rz]
def setRotation(self, rotation):
rotation[0] = rotation[0] % 360
rotation[1] = rotation[1] % 360
if rotation[2] != 0.0:
log.warning('Setting a non-zero rotation around Z axis is not supported!')
rotation[2] = 0.0
self.setRot(rotation[0], rotation[1], rotation[2])
def setRot(self, rx, ry, rz):
"""
This method sets the orientation of the object in the 3D coordinate space of the scene.
:param rx: Rotation around the x-axis.
:type rx: float
:param ry: Rotation around the y-axis.
:type ry: float
:param rz: Rotation around the z-axis.
:type rz: float
"""
self._rot[...] = (rx, ry, rz)
def getRotation(self):
return self._rot
rot = property(getRotation, setRotation)
def setScale(self, scale, scaleY=None, scaleZ=1):
"""
This method sets the scale of the object in the 3D coordinate space of
the scene, relative to the initially defined size of the object.
:param scale: Scale along the x-axis, uniform scale if other params not
specified.
:type scale: float
:param scaleY: Scale along the x-axis.
:type scaleY: float
:param scaleZ: Scale along the x-axis.
:type scaleZ: float
"""
if scaleY is None:
scaleY = scale
scaleZ = scale
self._scale[...] = (scale, scaleY, scaleZ)
def getScale(self):
return list(self._scale)
scale = property(getScale, setScale)
@property
def transform(self):
m = matrix.translate(self.loc)
if any(x != 0 for x in self.rot):
m = m * matrix.rotx(self.rx)
m = m * matrix.roty(self.ry)
m = m * matrix.rotz(self.rz)
if any(x != 1 for x in self.scale):
m = m * matrix.scale(self.scale)
return m
def getSeedMesh(self):
return self.__seedMesh
def getProxyMesh(self):
return self.__proxyMesh
def updateProxyMesh(self, fit_to_posed=False):
if self.proxy and self.__proxyMesh:
self.proxy.update(self.__proxyMesh, fit_to_posed)
self.__proxyMesh.update()
def isProxied(self):
return self.mesh == self.__proxyMesh or self.mesh == self.__proxySubdivisionMesh
def setProxy(self, proxy):
isSubdivided = self.isSubdivided()
if self.proxy:
self.proxy = None
self.detachMesh(self.__proxyMesh)
self.__proxyMesh.clear()
self.__proxyMesh = None
if self.__proxySubdivisionMesh:
self.detachMesh(self.__proxySubdivisionMesh)
self.__proxySubdivisionMesh.clear()
self.__proxySubdivisionMesh = None
self.mesh = self.__seedMesh
self.mesh.setVisibility(1)
if proxy:
import files3d
self.proxy = proxy
self.__proxyMesh = proxy.object.mesh.clone()
self.__proxyMesh.object = self
# Copy attributes from human mesh to proxy mesh
for attr in ('visibility', 'pickable', 'cameraMode'):
setattr(self.__proxyMesh, attr, getattr(self.mesh, attr))
self.updateProxyMesh()
# Attach to GL object if this object is attached to viewport
if self.__seedMesh.object3d:
self.attachMesh(self.__proxyMesh)
self.mesh.setVisibility(0)
self.mesh = self.__proxyMesh
self.mesh.setVisibility(1)
self.setSubdivided(isSubdivided)
def getProxy(self):
return self.proxy
def getSubdivisionMesh(self, update=True):
"""
Create or update the Catmull-Clark subdivided (or smoothed) mesh for
this mesh.
This does not change the status of isSubdivided(), use setSubdivided()
for that.
If this mesh is doubled by a proxy, when isProxied() is true, a
subdivision mesh for the proxy is used.
Returns the subdivided mesh data.
"""
import catmull_clark_subdivision as cks
if self.isProxied():
if not self.__proxySubdivisionMesh:
self.__proxySubdivisionMesh = cks.createSubdivisionObject(self.__proxyMesh, None)
if self.__seedMesh.object3d:
self.attachMesh(self.__proxySubdivisionMesh)
elif update:
cks.updateSubdivisionObject(self.__proxySubdivisionMesh)
return self.__proxySubdivisionMesh
else:
if not self.__subdivisionMesh:
self.__subdivisionMesh = cks.createSubdivisionObject(self.__seedMesh, self.staticFaceMask)
if self.__seedMesh.object3d:
self.attachMesh(self.__subdivisionMesh)
elif update:
cks.updateSubdivisionObject(self.__subdivisionMesh)
return self.__subdivisionMesh
def isSubdivided(self):
"""
Returns whether this mesh is currently set to be subdivided
(or smoothed).
"""
return self.mesh == self.__subdivisionMesh or self.mesh == self.__proxySubdivisionMesh
def setSubdivided(self, flag, update=True):
"""
Set whether this mesh is to be subdivided (or smoothed).
When set to true, the subdivision mesh is automatically created or
updated.
"""
if flag == self.isSubdivided():
return False
if flag:
self.mesh.setVisibility(0)
originalMesh = self.mesh
self.mesh = self.getSubdivisionMesh(update)
self.mesh.setVisibility(1)
else:
originalMesh = self.__seedMesh if self.mesh == self.__subdivisionMesh else self.__proxyMesh
self.mesh.setVisibility(0)
self.mesh = originalMesh
if update:
self.mesh.calcNormals()
self.mesh.update()
self.mesh.setVisibility(1)
return True
def updateSubdivisionMesh(self, rebuildIndexBuffer=False):
if rebuildIndexBuffer:
# Purge old subdivision mesh and recalculate entirely
self.setSubdivided(False)
self.__subdivisionMesh = self.__proxySubdivisionMesh = None
self.setSubdivided(True)
else:
self.getSubdivisionMesh(True)
def _setMeshUVMap(self, filename, mesh):
if filename == self.material.uvMap:
# No change, do nothing
return
if not hasattr(mesh, "_originalUVMap") or not mesh._originalUVMap:
# Backup original mesh UVs
mesh._originalUVMap = dict()
mesh._originalUVMap['texco'] = mesh.texco
mesh._originalUVMap['fuvs'] = mesh.fuvs
#self._originalUVMap['fvert'] = mesh.fvert
#self._originalUVMap['group'] = mesh.group
faceMask = mesh.getFaceMask()
faceGroups = mesh.group
self.material.uvMap = filename
if not filename:
# Restore original UVs
mesh.setUVs(mesh._originalUVMap['texco'])
mesh.setFaces(mesh.fvert, mesh._originalUVMap['fuvs'], faceGroups)
mesh._originalUVMap = None
else:
uvset = material.UVMap(filename)
uvset.read(mesh, filename)
if len(uvset.fuvs) != len(mesh.fuvs):
raise NameError("The UV file %s is not valid for mesh %s. \
Number of faces %d != %d" % (filename, mesh.name, \
len(uvset.fuvs), len(mesh.fuvs)))
mesh.setUVs(uvset.uvs)
mesh.setFaces(mesh.fvert, uvset.fuvs, faceGroups)
mesh.changeFaceMask(faceMask)
mesh.updateIndexBuffer()
@property
def staticFaceMask(self):
if not hasattr(self, '_staticFaceMask') or \
self._staticFaceMask is None:
# If not already set, consider the current face mask state of the
# mesh to be the static face mask
self._staticFaceMask = self.__seedMesh.face_mask.copy()
return self._staticFaceMask
def changeVertexMask(self, vertsMask):
"""
Apply a face mask to the meshes (original seed mesh, subdivided mesh
and proxied meshes) specified by a vertex mask.
The vertex mask is a list of booleans, one for each vertex, where True
means not masked (visible), and False means masked (hidden).
A face is masked if all of the vertices that define it are masked.
"""
if vertsMask is None:
# Undo face mask set by vertex mask
self.__seedMesh.changeFaceMask(self.staticFaceMask)
self.__seedMesh.updateIndexBufferFaces()
if self.__subdivisionMesh:
self.__subdivisionMesh.changeFaceMask(self.staticFaceMask)
self.__subdivisionMesh.updateIndexBufferFaces()
if self.__proxyMesh:
self.__proxyMesh.changeFaceMask(np.ones(self.__proxyMesh.getFaceCount(), dtype=bool))
self.__proxyMesh.updateIndexBufferFaces()
if self.__proxySubdivisionMesh:
self.__proxySubdivisionMesh.changeFaceMask(np.ones(self.__proxySubdivisionMesh.getFaceCount(), dtype=bool))
self.__proxySubdivisionMesh.updateIndexBufferFaces()
return
# Mask seed mesh
faceMask = self.__seedMesh.getFaceMaskForVertices(np.argwhere(vertsMask)[...,0])
self.__seedMesh.changeFaceMask(np.logical_and(faceMask, self.staticFaceMask))
self.__seedMesh.updateIndexBufferFaces()
import log
log.debug("%s faces masked for %s", np.count_nonzero(~faceMask), self.__seedMesh.name)
# Mask smoothed seed mesh
if self.__subdivisionMesh:
# Remap faceMask to subdivision mesh base faces, accounting for the
# excluded faces of the static facemask (staticFaceMask).
# Statically masked faces (staticFaceMask) are excluded from
# subdivision mesh geometry, for performance.
# Dynamically masked faces (eg. using this method) are not excluded
# from the subdivision mesh and simply masked, allowing faster
# changes to the face mask without requiring a rebuild of the
# subdivision mesh.
self.__subdivisionMesh.changeFaceMask(faceMask)
self.__subdivisionMesh.updateIndexBufferFaces()
# Mask proxy and subdivided proxy mesh
if self.__proxyMesh:
import proxy
# Transfer face mask to proxy
proxyVertMask = proxy.transferVertexMaskToProxy(vertsMask, self.proxy)
proxyFaceMask = self.__proxyMesh.getFaceMaskForVertices(np.argwhere(proxyVertMask)[...,0])
self.__proxyMesh.changeFaceMask(proxyFaceMask)
self.__proxyMesh.updateIndexBufferFaces()
if self.__proxySubdivisionMesh:
self.__proxySubdivisionMesh.changeFaceMask(proxyFaceMask)
self.__proxySubdivisionMesh.updateIndexBufferFaces()
##
# Material properties
##
def setTexture(self, path):
"""
This method is used to specify the path of a file on disk containing the object texture.
:param path: The path of a texture file.
:type path: str
:param cache: The texture cache to use.
:type cache: dict
"""
self.material.diffuseTexture = path
def getTexture(self):
return self.material.diffuseTexture
texture = property(getTexture, setTexture)
def clearTexture(self):
"""
This method is used to clear an object's texture.
"""
self.material.diffuseTexture = None
def hasTexture(self):
return self.texture is not None
def setShader(self, shader):
"""
This method is used to specify the shader.
:param shader: The path to a pair of shader files.
:type shader: string
"""
self.material.setShader(shader)
def getShader(self):
return self.material.shader
shader = property(getShader, setShader)
@property
def shaderObj(self):
return self.material.shaderObj
def configureShading(self, diffuse=None, bump = None, normal=None, displacement=None, spec = None, vertexColors = None):
"""
Configure shader options and set the necessary properties based on
the material configuration of this object.
This can be done without an actual shader being set for this object.
Call this method when changes are made to the material property.
"""
self.material.configureShading(diffuse, bump, normal, displacement, spec, vertexColors)
def getMaterial(self):
return self._material
def setMaterial(self, material):
if self.material.uvMap != material.uvMap:
# UV map has changed
self.setUVMap(material.uvMap)
self._material.copyFrom(material)
material = property(getMaterial, setMaterial)
def setShaderParameter(self, name, value):
"""
Updates the shader parameters.
"""
self.material.setShaderParameter(name, value)
@property
def shaderParameters(self):
return self.material.shaderParameters
@property
def shaderConfig(self):
return self.material.shaderConfig
@property
def shaderDefines(self):
return self.material.shaderDefines
def addShaderDefine(self, defineStr):
self.material.addShaderDefine(defineStr)
def removeShaderDefine(self, defineStr):
self.material.removeShaderDefine(defineStr)
def clearShaderDefines(self):
self.material.clearShaderDefines()
def setShadeless(self, shadeless):
"""
This method is used to specify whether or not the object is affected by lights.
This is used for certain GUI controls to give them a more 2D type
appearance (predominantly the top bar of GUI controls).
NOTE enabling this option disables the use of the shader configured in the material.
:param shadeless: Whether or not the object is unaffected by lights.
:type shadeless: Boolean
"""
self.material.shadeless = shadeless
def getShadeless(self):
return self.material.shadeless
shadeless = property(getShadeless, setShadeless)
def setDepthless(self, depthless):
"""
This method is used to specify whether or not the object occludes or is occluded
by other objects
:param depthless: Whether or not the object is occluded or occludes.
:type depthless: Boolean
"""
self.material.depthless = depthless
def getDepthless(self):
return self.material.depthless
depthless = property(getDepthless, setDepthless)
def setSolid(self, solid):
"""
This method is used to specify whether or not the object is drawn solid or wireframe.
:param solid: Whether or not the object is drawn solid or wireframe.
:type solid: Boolean
"""
self.material.wireframe = not solid
def isSolid(self):
return self.solid
def getSolid(self):
return not self.material.wireframe
solid = property(getSolid, setSolid)
def setCull(self, cull):
"""
This method is used to specify whether or not the object is back-face culled.
:param cull: Whether and how to cull
:type cull: 0 => no culling, >0 => draw front faces, <0 => draw back faces
"""
# Because we don't really need frontface culling, we simplify to only backface culling
if (isinstance(cull, bool) and cull) or cull > 0:
self.material.backfaceCull = True
else:
self.material.backfaceCull = False
def getCull(self):
# Because we don't really need frontface culling, we simplify to only backface culling
if self.material.backfaceCull:
return 1
else:
return 0
cull = property(getCull, setCull)
def getAlphaToCoverage(self):
return self.material.alphaToCoverage
def setAlphaToCoverage(self, a2cEnabled):
self.material.alphaToCoverage = a2cEnabled
alphaToCoverage = property(getAlphaToCoverage, setAlphaToCoverage)
def setUVMap(self, filename):
subdivided = self.isSubdivided()
if subdivided:
# Re-generate the subdivided mesh
self.setSubdivided(False)
# Remove stale subdivision cache if present
self.__subdivisionMesh = None
# Set uv map on original, unsubdivided, unproxied mesh
self._setMeshUVMap(filename, self.__seedMesh)
if self.isProxied():
# TODO transfer UV coordinates to proxy mesh
pass
if subdivided:
# Re-generate the subdivided mesh with new UV coordinates
self.setSubdivided(True)
def onMouseDown(self, event):
if self.view:
self.view.callEvent('onMouseDown', event)
else:
import log
log.debug('FAILED: mouseDown')
def onMouseMoved(self, event):
if self.view:
self.view.callEvent('onMouseMoved', event)
else:
import log
log.debug('FAILED: mouseMoved')
def onMouseDragged(self, event):
if self.view:
self.view.callEvent('onMouseDragged', event)
else:
import log
log.debug('FAILED: mouseDragged')
def onMouseUp(self, event):
if self.view:
self.view.callEvent('onMouseUp', event)
def onMouseEntered(self, event):
if self.view:
self.view.callEvent('onMouseEntered', event)
else:
import log
log.debug('FAILED: mouseEntered')
def onMouseExited(self, event):
if self.view:
self.view.callEvent('onMouseExited', event)
else:
import log
log.debug('FAILED: mouseExited')
def onClicked(self, event):
if self.view:
self.view.callEvent('onClicked', event)
else:
import log
log.debug('FAILED: clicked')
def onMouseWheel(self, event):
if self.view:
self.view.callEvent('onMouseWheel', event)