Skip to content

Commit df242ef

Browse files
authored
Merge pull request #1311 from yannci/ieSceneShapeProxy
SceneShapeProxy
2 parents b6182a1 + d0cd1f4 commit df242ef

File tree

16 files changed

+520
-118
lines changed

16 files changed

+520
-118
lines changed

include/IECoreMaya/MayaTypeIds.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ enum MayaTypeId
6767
GeometryCombinerId = 0x00110DD2,
6868
SceneShapeId = 0x00110DD3,
6969
SceneShapeInterfaceId = 0x00110DD4,
70+
SceneShapeProxyId = 0x00110DD5,
7071
/// Don't forget to update MayaTypeIdsBinding.cpp
7172

7273
LastId = 0x00110E3F,
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (c) 2022, Image Engine Design Inc. All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above copyright
13+
// notice, this list of conditions and the following disclaimer in the
14+
// documentation and/or other materials provided with the distribution.
15+
//
16+
// * Neither the name of Image Engine Design nor the names of any
17+
// other contributors to this software may be used to endorse or
18+
// promote products derived from this software without specific prior
19+
// written permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
//////////////////////////////////////////////////////////////////////////
34+
35+
#ifndef IE_COREMAYA_SCENESHAPEPROXY_H
36+
#define IE_COREMAYA_SCENESHAPEPROXY_H
37+
38+
#include "IECoreMaya/SceneShape.h"
39+
40+
namespace IECoreMaya
41+
{
42+
43+
/// A proxy derived from the SceneShape which exposes the same functionality as the base clase
44+
/// with the exception, that we never register it as a maya SubSceneOverride. The reasoning
45+
/// behind this is that the SubSceneOverride does not take into account the visibility state of the shape.
46+
/// During an update loop of the SubSceneOverride, all SceneShapes will be queried for their update state,
47+
/// regardless their visibility in the scene. This query is slow and we get a huge drop in performance
48+
/// when having a huge amount of SceneShapes in the scene.
49+
/// This is considered to be a bug in the ViewPort 2 API. Our attempts to rewrite the code to use
50+
/// "MPxGeometryOverride" or "MPxDrawOverride" prove themselves as unstable or not suitable for our
51+
/// use case, why we decided to use this "hackery" and not register a proxy of the SceneShape for
52+
/// drawing at all
53+
class IECOREMAYA_API SceneShapeProxy : public SceneShape
54+
{
55+
public :
56+
57+
SceneShapeProxy();
58+
virtual ~SceneShapeProxy();
59+
60+
static void *creator();
61+
static MStatus initialize();
62+
static MTypeId id;
63+
};
64+
65+
}
66+
67+
#endif // IE_COREMAYA_SCENESHAPEPROXY_H
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (c) 2022, Image Engine Design Inc. All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above copyright
13+
// notice, this list of conditions and the following disclaimer in the
14+
// documentation and/or other materials provided with the distribution.
15+
//
16+
// * Neither the name of Image Engine Design nor the names of any
17+
// other contributors to this software may be used to endorse or
18+
// promote products derived from this software without specific prior
19+
// written permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
//////////////////////////////////////////////////////////////////////////
34+
35+
#ifndef IECOREMAYA_SCENESHAPEPROXYUI_H
36+
#define IECOREMAYA_SCENESHAPEPROXYUI_H
37+
38+
#include "maya/MPxSurfaceShapeUI.h"
39+
#include "maya/MTypes.h"
40+
#include "IECoreMaya/Export.h"
41+
42+
namespace IECoreMaya
43+
{
44+
45+
/// The SceneShapeProxyUI is required for the registration of the SceneShapeProxy and we just make it a NoOp
46+
/// TODO: It might be worth to see if the SceneShapeUI has any dependencies on the drawing capabilities of the
47+
/// shape and if that's not the case, register SceneShapeProxy with the original implementation of SceneShapeUI
48+
class IECOREMAYA_API SceneShapeProxyUI : public MPxSurfaceShapeUI
49+
{
50+
51+
public :
52+
53+
SceneShapeProxyUI();
54+
static void *creator();
55+
};
56+
57+
} // namespace IECoreMaya
58+
59+
#endif // IECOREMAYA_SCENESHAPEPROXYUI_H

mel/IECoreMaya/IECoreMaya.mel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ source "IECoreMaya/ieDrawableHolderUI.mel";
5353
source "IECoreMaya/ieGeometryCombinerUI.mel";
5454
source "IECoreMaya/ieCurveCombinerUI.mel";
5555
source "IECoreMaya/ieSceneShapeUI.mel";
56+
source "IECoreMaya/ieSceneShapeProxyUI.mel";
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (c) 2022, Image Engine Design Inc. All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above copyright
13+
// notice, this list of conditions and the following disclaimer in the
14+
// documentation and/or other materials provided with the distribution.
15+
//
16+
// * Neither the name of Image Engine Design nor the names of any
17+
// other contributors to this software may be used to endorse or
18+
// promote products derived from this software without specific prior
19+
// written permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
//////////////////////////////////////////////////////////////////////////
34+
35+
36+
global proc AEieSceneShapeProxyTemplate( string $nodeName )
37+
{
38+
editorTemplate -beginScrollLayout;
39+
40+
editorTemplate -beginLayout "Inputs";
41+
editorTemplate -annotation "Path to the scene interface file." -addControl "file" ;
42+
editorTemplate -annotation "Path in the scene interface where you start reading." -addControl "root";
43+
editorTemplate -annotation "If on, only read the object at the root path." -addControl "objectOnly";
44+
editorTemplate -addControl "time";
45+
46+
editorTemplate -endLayout;
47+
48+
editorTemplate -beginLayout "Queries";
49+
editorTemplate -addControl "querySpace";
50+
editorTemplate -addControl "queryPaths";
51+
editorTemplate -addControl "queryAttributes";
52+
editorTemplate -addControl "queryConvertParameters";
53+
54+
editorTemplate -endLayout;
55+
56+
editorTemplate -beginLayout "All Dynamic Attributes";
57+
editorTemplate -beginLayout "Open With Caution - Maya May Hang";
58+
editorTemplate -extraControlsLabel "Too Late Now!" -addExtraControls;
59+
editorTemplate -endLayout;
60+
editorTemplate -endLayout;
61+
62+
editorTemplate -endScrollLayout;
63+
}

0 commit comments

Comments
 (0)