@@ -9,9 +9,9 @@ public RenderColour()
9
9
//{ }
10
10
: base ( )
11
11
{
12
- Name = "Render Colour " ;
12
+ Name = "Render colour " ;
13
13
NickName = "Colour" ;
14
- Description = "Creates colour list for custom preview " ;
14
+ Description = "Adds colour to robot mesh " ;
15
15
Category = "Robots" ;
16
16
SubCategory = "Utility" ;
17
17
}
@@ -53,7 +53,6 @@ protected override void BeforeSolveInstance()
53
53
{
54
54
_items = [ ] ;
55
55
_boundingBox = BoundingBox . Empty ;
56
- //meshes.Clear();
57
56
//base.BeforeSolveInstance();
58
57
}
59
58
override protected void AfterSolveInstance ( )
@@ -141,68 +140,42 @@ void Append(GH_Mesh m, Color c)
141
140
{
142
141
if ( ! m . IsValid ) return ;
143
142
GH_Material material = new ( c ) ;
144
- GH_CustomPreviewItem item = default ;
145
- item . Geometry = m ;
146
- item . Shader = material . Value ;
147
- item . Colour = material . Value . Diffuse ;
148
- item . Material = material ;
143
+ GH_CustomPreviewItem item = new ( )
144
+ {
145
+ Geometry = m ,
146
+ Shader = material . Value ,
147
+ Colour = material . Value . Diffuse ,
148
+ Material = material ,
149
+ } ;
149
150
_items . Add ( item ) ;
150
151
_boundingBox . Union ( m . Boundingbox ) ;
151
152
}
152
153
}
153
154
public override void DrawViewportMeshes ( IGH_PreviewArgs args )
154
155
{
155
- if ( this . Locked || _items . Count == 0 || args . Document . IsRenderMeshPipelineViewport ( args . Display ) )
156
+ if ( this . Locked || _items . Count == 0 )
156
157
return ;
157
158
if ( this . Attributes . Selected )
158
159
{
159
160
GH_PreviewMeshArgs args2 = new ( args . Viewport , args . Display , args . ShadeMaterial_Selected , args . MeshingParameters ) ;
160
161
foreach ( GH_CustomPreviewItem item in _items )
161
162
item . Geometry . DrawViewportMeshes ( args2 ) ;
162
- //for (int i = 0; i < meshes.Count; i++)
163
- // meshes[i].DrawViewportMeshes(args2);
164
163
return ;
165
164
}
166
165
foreach ( GH_CustomPreviewItem item in _items )
167
166
{
168
167
GH_PreviewMeshArgs args2 = new ( args . Viewport , args . Display , item . Shader , args . MeshingParameters ) ;
169
168
item . Geometry . DrawViewportMeshes ( args2 ) ;
170
169
}
171
- //for (int i = 0; i < meshes.Count; i++)
172
- //{
173
- // GH_PreviewMeshArgs args2 = new(args.Viewport, args.Display, new DisplayMaterial(colors[i]), args.MeshingParameters);
174
- // meshes[i].DrawViewportMeshes(args2);
175
- //}
176
- //for(int i = 0; i<meshes.Count; i++)
177
- // args.Display.DrawMeshShaded(meshes[i].Value, new DisplayMaterial(colors[i]));
178
- //base.DrawViewportMeshes(args);
179
170
}
180
- //public void AppendCustomGeometry(GH_RenderArgs args)
181
- //{
182
- // if (_items == null || _items.Count == 0)
183
- // {
184
- // return;
185
- // }
186
-
187
- // GH_Document gH_Document = OnPingDocument();
188
- // if (gH_Document != null && (gH_Document.PreviewMode == GH_PreviewMode.Disabled || _items.Count == 0 || gH_Document.PreviewMode == GH_PreviewMode.Wireframe))
189
- // return;
190
171
191
- // foreach (var item in _items)
192
- // item.PushToRenderPipeline(args);
193
- //}
194
-
195
- [ Obsolete ] // For Rhino 7
172
+ [ Obsolete ]
196
173
public override void AppendRenderGeometry ( GH_RenderArgs args )
197
174
{
198
- GH_Document gH_Document = OnPingDocument ( ) ;
199
- if ( gH_Document != null && ( gH_Document . PreviewMode == GH_PreviewMode . Disabled || _items . Count == 0 || gH_Document . PreviewMode == GH_PreviewMode . Wireframe ) )
175
+ if ( _items != null || _items . Count == 0 )
200
176
return ;
201
177
foreach ( var item in _items )
202
178
item . PushToRenderPipeline ( args ) ;
203
- //args.Geomety.Add(item.Value,args.MaterialNormal);
204
- //base.AppendRenderGeometry(args);
205
179
}
206
-
207
180
}
208
181
}
0 commit comments