Skip to content

Commit 00b1761

Browse files
committed
musculoskeletal dog creation
1 parent f2f0e23 commit 00b1761

File tree

606 files changed

+90956
-1003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

606 files changed

+90956
-1003
lines changed

dm_control/_render/pyopengl/egl_renderer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,13 @@ def _platform_init(self, unused_max_width, unused_max_height):
103103
"""Initialization this EGL context."""
104104
num_configs = ctypes.c_long(0)
105105
config_size = 1
106-
config = EGL.EGLConfig()
106+
# ctypes syntax for making an array of length config_size.
107+
configs = (EGL.EGLConfig * config_size)()
107108
EGL.eglReleaseThread()
108109
EGL.eglChooseConfig(
109110
EGL_DISPLAY,
110111
EGL_ATTRIBUTES,
111-
ctypes.byref(config),
112+
configs,
112113
config_size,
113114
num_configs)
114115
if num_configs.value < 1:
@@ -117,7 +118,7 @@ def _platform_init(self, unused_max_width, unused_max_height):
117118
'desired attributes: {}'.format(EGL_ATTRIBUTES))
118119
EGL.eglBindAPI(EGL.EGL_OPENGL_API)
119120
self._context = EGL.eglCreateContext(
120-
EGL_DISPLAY, config, EGL.EGL_NO_CONTEXT, None)
121+
EGL_DISPLAY, configs[0], EGL.EGL_NO_CONTEXT, None)
121122
if not self._context:
122123
raise RuntimeError('Cannot create an EGL context.')
123124

dm_control/autowrap/header_parsing.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ def _nested_if_else(if_, pred, else_, endif, match_if_true, match_if_false):
7878
return ifelse
7979

8080

81+
def _nested_ifn_else(ifn_, pred, else_, endif, match_if_true, match_if_false):
82+
"""Constructs a parser for (possibly nested) if...(else)...endif blocks."""
83+
ifnelse = pp.Forward()
84+
ifnelse << pp.Group( # pylint: disable=expression-not-assigned
85+
ifn_ +
86+
pred("predicate") +
87+
pp.ZeroOrMore(match_if_true | ifnelse)("if_false") +
88+
pp.Optional(else_ +
89+
pp.ZeroOrMore(match_if_false | ifnelse)("if_true")) +
90+
endif)
91+
return ifnelse
92+
93+
8194
# Some common string patterns to suppress.
8295
# ------------------------------------------------------------------------------
8396
(LPAREN, RPAREN, LBRACK, RBRACK, LBRACE, RBRACE, SEMI, COMMA, EQUAL, FSLASH,
@@ -189,7 +202,9 @@ def _nested_if_else(if_, pred, else_, endif, match_if_true, match_if_false):
189202
UNCOND_DECL = DEF_FLAG | DEF_CONST | TYPE_DECL
190203

191204
# Declarations inside (possibly nested) #if(n)def... #else... #endif... blocks.
192-
COND_DECL = _nested_if_else(IFDEF, NAME, ELSE, ENDIF, UNCOND_DECL, UNCOND_DECL)
205+
COND_DECL = _nested_if_else(
206+
IFDEF, NAME, ELSE, ENDIF, UNCOND_DECL, UNCOND_DECL
207+
) | _nested_ifn_else(IFNDEF, NAME, ELSE, ENDIF, UNCOND_DECL, UNCOND_DECL)
193208
# Note: this doesn't work for '#if defined(FLAG)' blocks
194209

195210
# e.g. "mjtNum gravity[3]; // gravitational acceleration"
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# Copyright 2023 The dm_control Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ============================================================================
15+
16+
"""Fake Blender bpy module."""
17+
18+
from __future__ import annotations # postponed evaluation of annotations
19+
20+
from typing import Any, Collection, Sequence
21+
22+
from dm_control.blender.fake_core import mathutils
23+
24+
# pylint: disable=invalid-name
25+
# pylint: disable=missing-class-docstring
26+
27+
28+
class WindowManager:
29+
30+
def progress_begin(self, start: int, end: int):
31+
pass
32+
33+
def progress_update(self, steps_done: int):
34+
pass
35+
36+
def progress_end(self):
37+
pass
38+
39+
40+
class context:
41+
42+
@property
43+
def window_manager(self) -> WindowManager:
44+
return WindowManager()
45+
46+
@staticmethod
47+
def evaluated_depsgraph_get():
48+
pass
49+
50+
51+
class types:
52+
53+
class Constraint:
54+
55+
@property
56+
def name(self):
57+
pass
58+
59+
@property
60+
def owner_space(self):
61+
pass
62+
63+
class Scene:
64+
pass
65+
66+
class Object:
67+
68+
@property
69+
def name(self) -> str:
70+
raise NotImplementedError()
71+
72+
@property
73+
def parent(self) -> types.Object | None:
74+
pass
75+
76+
@property
77+
def parent_bone(self) -> types.Bone | None:
78+
pass
79+
80+
@property
81+
def data(self):
82+
pass
83+
84+
@property
85+
def pose(self):
86+
pass
87+
88+
@property
89+
def matrix_world(self) -> mathutils.Matrix:
90+
raise NotImplementedError()
91+
92+
@matrix_world.setter
93+
def matrix_world(self, _) -> mathutils.Matrix:
94+
raise NotImplementedError()
95+
96+
def select_set(self, _):
97+
pass
98+
99+
def to_mesh(self):
100+
pass
101+
102+
def evaluated_get(self, _) -> types.Object:
103+
pass
104+
105+
@property
106+
def mode(self) -> str:
107+
return 'OBJECT'
108+
109+
@property
110+
def type(self):
111+
pass
112+
113+
def update_from_editmode(self):
114+
pass
115+
116+
class Bone:
117+
118+
@property
119+
def name(self) -> str:
120+
raise NotImplementedError()
121+
122+
@property
123+
def parent(self) -> types.Bone | None:
124+
pass
125+
126+
@property
127+
def matrix_local(self) -> mathutils.Matrix:
128+
raise NotImplementedError()
129+
130+
@property
131+
def matrix(self) -> mathutils.Matrix:
132+
raise NotImplementedError()
133+
134+
class bpy_struct:
135+
pass
136+
137+
class Context:
138+
139+
@property
140+
def scene(self) -> types.Scene:
141+
pass
142+
143+
class Light:
144+
145+
@property
146+
def type(self):
147+
pass
148+
149+
@property
150+
def use_shadow(self):
151+
pass
152+
153+
@property
154+
def color(self) -> mathutils.Color:
155+
raise NotImplementedError()
156+
157+
@property
158+
def linear_attenuation(self):
159+
pass
160+
161+
@property
162+
def quadratic_attenuation(self):
163+
pass
164+
165+
class LimitRotationConstraint(Constraint):
166+
pass
167+
168+
class LimitLocationConstraint(Constraint):
169+
pass
170+
171+
class Material:
172+
173+
@property
174+
def name(self) -> str:
175+
raise NotImplementedError()
176+
177+
@property
178+
def specular_intensity(self):
179+
pass
180+
181+
@property
182+
def metallic(self):
183+
pass
184+
185+
@property
186+
def roughness(self) -> float:
187+
raise NotImplementedError()
188+
189+
@property
190+
def diffuse_color(self) -> Sequence[float]:
191+
raise NotImplementedError()
192+
193+
class Mesh:
194+
195+
@property
196+
def name(self) -> str:
197+
raise NotImplementedError()
198+
199+
def calc_loop_triangles(self):
200+
pass
201+
202+
@property
203+
def uv_layers(self) -> Any:
204+
raise NotImplementedError()
205+
206+
@property
207+
def loop_triangles(self) -> Collection[Any]:
208+
raise NotImplementedError()
209+
210+
@property
211+
def vertices(self) -> Any:
212+
raise NotImplementedError()
213+
214+
215+
class ops:
216+
217+
class object:
218+
219+
@staticmethod
220+
def select_all(action):
221+
pass
222+
223+
class export_mesh:
224+
225+
@classmethod
226+
def stl(
227+
cls, filepath, use_selection, use_mesh_modifiers, axis_forward, axis_up
228+
):
229+
pass

0 commit comments

Comments
 (0)