Blender  V2.93
blender_util.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __BLENDER_UTIL_H__
18 #define __BLENDER_UTIL_H__
19 
20 #include "render/mesh.h"
21 
22 #include "util/util_algorithm.h"
23 #include "util/util_array.h"
24 #include "util/util_map.h"
25 #include "util/util_path.h"
26 #include "util/util_set.h"
27 #include "util/util_transform.h"
28 #include "util/util_types.h"
29 #include "util/util_vector.h"
30 
31 /* Hacks to hook into Blender API
32  * todo: clean this up ... */
33 
34 extern "C" {
35 void BKE_image_user_frame_calc(void *ima, void *iuser, int cfra);
36 void BKE_image_user_file_path(void *iuser, void *ima, char *path);
37 unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame, int tile);
38 float *BKE_image_get_float_pixels_for_frame(void *image, int frame, int tile);
39 }
40 
42 
43 typedef BL::ShaderNodeAttribute::attribute_type_enum BlenderAttributeType;
44 BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_real_name);
45 
46 void python_thread_state_save(void **python_thread_state);
47 void python_thread_state_restore(void **python_thread_state);
48 
49 static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
50  BL::Object &object,
51  BL::Depsgraph & /*depsgraph*/,
52  bool /*calc_undeformed*/,
53  Mesh::SubdivisionType subdivision_type)
54 {
55  /* TODO: make this work with copy-on-write, modifiers are already evaluated. */
56 #if 0
57  bool subsurf_mod_show_render = false;
58  bool subsurf_mod_show_viewport = false;
59 
60  if (subdivision_type != Mesh::SUBDIVISION_NONE) {
61  BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length() - 1];
62 
63  subsurf_mod_show_render = subsurf_mod.show_render();
64  subsurf_mod_show_viewport = subsurf_mod.show_viewport();
65 
66  subsurf_mod.show_render(false);
67  subsurf_mod.show_viewport(false);
68  }
69 #endif
70 
72  if (object.type() == BL::Object::type_MESH) {
73  /* TODO: calc_undeformed is not used. */
74  mesh = BL::Mesh(object.data());
75 
76  /* Make a copy to split faces if we use autosmooth, otherwise not needed.
77  * Also in edit mode do we need to make a copy, to ensure data layers like
78  * UV are not empty. */
79  if (mesh.is_editmode() ||
80  (mesh.use_auto_smooth() && subdivision_type == Mesh::SUBDIVISION_NONE)) {
82  mesh = object.to_mesh(false, depsgraph);
83  }
84  }
85  else {
87  mesh = object.to_mesh(false, depsgraph);
88  }
89 
90 #if 0
91  if (subdivision_type != Mesh::SUBDIVISION_NONE) {
92  BL::Modifier subsurf_mod = object.modifiers[object.modifiers.length() - 1];
93 
94  subsurf_mod.show_render(subsurf_mod_show_render);
95  subsurf_mod.show_viewport(subsurf_mod_show_viewport);
96  }
97 #endif
98 
99  if ((bool)mesh && subdivision_type == Mesh::SUBDIVISION_NONE) {
100  if (mesh.use_auto_smooth()) {
101  mesh.split_faces(false);
102  }
103 
104  mesh.calc_loop_triangles();
105  }
106 
107  return mesh;
108 }
109 
110 static inline void free_object_to_mesh(BL::BlendData & /*data*/,
111  BL::Object &object,
112  BL::Mesh &mesh)
113 {
114  /* Free mesh if we didn't just use the existing one. */
115  if (object.data().ptr.data != mesh.ptr.data) {
116  object.to_mesh_clear();
117  }
118 }
119 
120 static inline void colorramp_to_array(BL::ColorRamp &ramp,
121  array<float3> &ramp_color,
122  array<float> &ramp_alpha,
123  int size)
124 {
125  ramp_color.resize(size);
126  ramp_alpha.resize(size);
127 
128  for (int i = 0; i < size; i++) {
129  float color[4];
130 
131  ramp.evaluate((float)i / (float)(size - 1), color);
132  ramp_color[i] = make_float3(color[0], color[1], color[2]);
133  ramp_alpha[i] = color[3];
134  }
135 }
136 
137 static inline void curvemap_minmax_curve(/*const*/ BL::CurveMap &curve, float *min_x, float *max_x)
138 {
139  *min_x = min(*min_x, curve.points[0].location()[0]);
140  *max_x = max(*max_x, curve.points[curve.points.length() - 1].location()[0]);
141 }
142 
143 static inline void curvemapping_minmax(/*const*/ BL::CurveMapping &cumap,
144  bool rgb_curve,
145  float *min_x,
146  float *max_x)
147 {
148  /* const int num_curves = cumap.curves.length(); */ /* Gives linking error so far. */
149  const int num_curves = rgb_curve ? 4 : 3;
150  *min_x = FLT_MAX;
151  *max_x = -FLT_MAX;
152  for (int i = 0; i < num_curves; ++i) {
153  BL::CurveMap map(cumap.curves[i]);
154  curvemap_minmax_curve(map, min_x, max_x);
155  }
156 }
157 
159 {
160  cumap.update();
161  BL::CurveMap curve = cumap.curves[0];
162  data.resize(size);
163  for (int i = 0; i < size; i++) {
164  float t = (float)i / (float)(size - 1);
165  data[i] = cumap.evaluate(curve, t);
166  }
167 }
168 
171  int size,
172  bool rgb_curve)
173 {
174  float min_x = 0.0f, max_x = 1.0f;
175 
176  /* TODO(sergey): There is no easy way to automatically guess what is
177  * the range to be used here for the case when mapping is applied on
178  * top of another mapping (i.e. R curve applied on top of common
179  * one).
180  *
181  * Using largest possible range form all curves works correct for the
182  * cases like vector curves and should be good enough heuristic for
183  * the color curves as well.
184  *
185  * There might be some better estimations here tho.
186  */
187  curvemapping_minmax(cumap, rgb_curve, &min_x, &max_x);
188 
189  const float range_x = max_x - min_x;
190 
191  cumap.update();
192 
193  BL::CurveMap mapR = cumap.curves[0];
194  BL::CurveMap mapG = cumap.curves[1];
195  BL::CurveMap mapB = cumap.curves[2];
196 
197  data.resize(size);
198 
199  if (rgb_curve) {
200  BL::CurveMap mapI = cumap.curves[3];
201  for (int i = 0; i < size; i++) {
202  const float t = min_x + (float)i / (float)(size - 1) * range_x;
203  data[i] = make_float3(cumap.evaluate(mapR, cumap.evaluate(mapI, t)),
204  cumap.evaluate(mapG, cumap.evaluate(mapI, t)),
205  cumap.evaluate(mapB, cumap.evaluate(mapI, t)));
206  }
207  }
208  else {
209  for (int i = 0; i < size; i++) {
210  float t = min_x + (float)i / (float)(size - 1) * range_x;
211  data[i] = make_float3(
212  cumap.evaluate(mapR, t), cumap.evaluate(mapG, t), cumap.evaluate(mapB, t));
213  }
214  }
215 }
216 
217 static inline bool BKE_object_is_modified(BL::Object &self, BL::Scene &scene, bool preview)
218 {
219  return self.is_modified(scene, (preview) ? (1 << 0) : (1 << 1)) ? true : false;
220 }
221 
222 static inline bool BKE_object_is_deform_modified(BL::Object &self, BL::Scene &scene, bool preview)
223 {
224  return self.is_deform_modified(scene, (preview) ? (1 << 0) : (1 << 1)) ? true : false;
225 }
226 
227 static inline int render_resolution_x(BL::RenderSettings &b_render)
228 {
229  return b_render.resolution_x() * b_render.resolution_percentage() / 100;
230 }
231 
232 static inline int render_resolution_y(BL::RenderSettings &b_render)
233 {
234  return b_render.resolution_y() * b_render.resolution_percentage() / 100;
235 }
236 
237 static inline string image_user_file_path(BL::ImageUser &iuser,
238  BL::Image &ima,
239  int cfra,
240  bool load_tiled)
241 {
242  char filepath[1024];
243  iuser.tile(0);
244  BKE_image_user_frame_calc(ima.ptr.data, iuser.ptr.data, cfra);
245  BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, filepath);
246 
247  string filepath_str = string(filepath);
248  if (load_tiled && ima.source() == BL::Image::source_TILED) {
249  string_replace(filepath_str, "1001", "<UDIM>");
250  }
251  return filepath_str;
252 }
253 
254 static inline int image_user_frame_number(BL::ImageUser &iuser, BL::Image &ima, int cfra)
255 {
256  BKE_image_user_frame_calc(ima.ptr.data, iuser.ptr.data, cfra);
257  return iuser.frame_current();
258 }
259 
260 static inline unsigned char *image_get_pixels_for_frame(BL::Image &image, int frame, int tile)
261 {
262  return BKE_image_get_pixels_for_frame(image.ptr.data, frame, tile);
263 }
264 
265 static inline float *image_get_float_pixels_for_frame(BL::Image &image, int frame, int tile)
266 {
267  return BKE_image_get_float_pixels_for_frame(image.ptr.data, frame, tile);
268 }
269 
270 static inline void render_add_metadata(BL::RenderResult &b_rr, string name, string value)
271 {
272  b_rr.stamp_data_add_field(name.c_str(), value.c_str());
273 }
274 
275 /* Utilities */
276 
277 static inline Transform get_transform(const BL::Array<float, 16> &array)
278 {
279  ProjectionTransform projection;
280 
281  /* We assume both types to be just 16 floats, and transpose because blender
282  * use column major matrix order while we use row major. */
283  memcpy((void *)&projection, &array, sizeof(float) * 16);
284  projection = projection_transpose(projection);
285 
286  /* Drop last row, matrix is assumed to be affine transform. */
287  return projection_to_transform(projection);
288 }
289 
290 static inline float2 get_float2(const BL::Array<float, 2> &array)
291 {
292  return make_float2(array[0], array[1]);
293 }
294 
295 static inline float3 get_float3(const BL::Array<float, 2> &array)
296 {
297  return make_float3(array[0], array[1], 0.0f);
298 }
299 
300 static inline float3 get_float3(const BL::Array<float, 3> &array)
301 {
302  return make_float3(array[0], array[1], array[2]);
303 }
304 
305 static inline float3 get_float3(const BL::Array<float, 4> &array)
306 {
307  return make_float3(array[0], array[1], array[2]);
308 }
309 
310 static inline float4 get_float4(const BL::Array<float, 4> &array)
311 {
312  return make_float4(array[0], array[1], array[2], array[3]);
313 }
314 
315 static inline int3 get_int3(const BL::Array<int, 3> &array)
316 {
317  return make_int3(array[0], array[1], array[2]);
318 }
319 
320 static inline int4 get_int4(const BL::Array<int, 4> &array)
321 {
322  return make_int4(array[0], array[1], array[2], array[3]);
323 }
324 
325 static inline float3 get_float3(PointerRNA &ptr, const char *name)
326 {
327  float3 f;
328  RNA_float_get_array(&ptr, name, &f.x);
329  return f;
330 }
331 
332 static inline void set_float3(PointerRNA &ptr, const char *name, float3 value)
333 {
334  RNA_float_set_array(&ptr, name, &value.x);
335 }
336 
337 static inline float4 get_float4(PointerRNA &ptr, const char *name)
338 {
339  float4 f;
340  RNA_float_get_array(&ptr, name, &f.x);
341  return f;
342 }
343 
344 static inline void set_float4(PointerRNA &ptr, const char *name, float4 value)
345 {
346  RNA_float_set_array(&ptr, name, &value.x);
347 }
348 
349 static inline bool get_boolean(PointerRNA &ptr, const char *name)
350 {
351  return RNA_boolean_get(&ptr, name) ? true : false;
352 }
353 
354 static inline void set_boolean(PointerRNA &ptr, const char *name, bool value)
355 {
356  RNA_boolean_set(&ptr, name, (int)value);
357 }
358 
359 static inline float get_float(PointerRNA &ptr, const char *name)
360 {
361  return RNA_float_get(&ptr, name);
362 }
363 
364 static inline void set_float(PointerRNA &ptr, const char *name, float value)
365 {
366  RNA_float_set(&ptr, name, value);
367 }
368 
369 static inline int get_int(PointerRNA &ptr, const char *name)
370 {
371  return RNA_int_get(&ptr, name);
372 }
373 
374 static inline void set_int(PointerRNA &ptr, const char *name, int value)
375 {
376  RNA_int_set(&ptr, name, value);
377 }
378 
379 /* Get a RNA enum value with sanity check: if the RNA value is above num_values
380  * the function will return a fallback default value.
381  *
382  * NOTE: This function assumes that RNA enum values are a continuous sequence
383  * from 0 to num_values-1. Be careful to use it with enums where some values are
384  * deprecated!
385  */
386 static inline int get_enum(PointerRNA &ptr,
387  const char *name,
388  int num_values = -1,
389  int default_value = -1)
390 {
391  int value = RNA_enum_get(&ptr, name);
392  if (num_values != -1 && value >= num_values) {
393  assert(default_value != -1);
394  value = default_value;
395  }
396  return value;
397 }
398 
399 static inline string get_enum_identifier(PointerRNA &ptr, const char *name)
400 {
401  PropertyRNA *prop = RNA_struct_find_property(&ptr, name);
402  const char *identifier = "";
403  int value = RNA_property_enum_get(&ptr, prop);
404 
405  RNA_property_enum_identifier(NULL, &ptr, prop, value, &identifier);
406 
407  return string(identifier);
408 }
409 
410 static inline void set_enum(PointerRNA &ptr, const char *name, int value)
411 {
412  RNA_enum_set(&ptr, name, value);
413 }
414 
415 static inline void set_enum(PointerRNA &ptr, const char *name, const string &identifier)
416 {
417  RNA_enum_set_identifier(NULL, &ptr, name, identifier.c_str());
418 }
419 
420 static inline string get_string(PointerRNA &ptr, const char *name)
421 {
422  char cstrbuf[1024];
423  char *cstr = RNA_string_get_alloc(&ptr, name, cstrbuf, sizeof(cstrbuf));
424  string str(cstr);
425  if (cstr != cstrbuf)
426  MEM_freeN(cstr);
427 
428  return str;
429 }
430 
431 static inline void set_string(PointerRNA &ptr, const char *name, const string &value)
432 {
433  RNA_string_set(&ptr, name, value.c_str());
434 }
435 
436 /* Relative Paths */
437 
438 static inline string blender_absolute_path(BL::BlendData &b_data, BL::ID &b_id, const string &path)
439 {
440  if (path.size() >= 2 && path[0] == '/' && path[1] == '/') {
441  string dirname;
442 
443  if (b_id.library()) {
444  BL::ID b_library_id(b_id.library());
445  dirname = blender_absolute_path(b_data, b_library_id, b_id.library().filepath());
446  }
447  else
448  dirname = b_data.filepath();
449 
450  return path_join(path_dirname(dirname), path.substr(2));
451  }
452 
453  return path;
454 }
455 
456 static inline string get_text_datablock_content(const PointerRNA &ptr)
457 {
458  if (ptr.data == NULL) {
459  return "";
460  }
461 
462  string content;
463  BL::Text::lines_iterator iter;
464  for (iter.begin(ptr); iter; ++iter) {
465  content += iter->body() + "\n";
466  }
467 
468  return content;
469 }
470 
471 /* Texture Space */
472 
473 static inline void mesh_texture_space(BL::Mesh &b_mesh, float3 &loc, float3 &size)
474 {
475  loc = get_float3(b_mesh.texspace_location());
476  size = get_float3(b_mesh.texspace_size());
477 
478  if (size.x != 0.0f)
479  size.x = 0.5f / size.x;
480  if (size.y != 0.0f)
481  size.y = 0.5f / size.y;
482  if (size.z != 0.0f)
483  size.z = 0.5f / size.z;
484 
485  loc = loc * size - make_float3(0.5f, 0.5f, 0.5f);
486 }
487 
488 /* Object motion steps, returns 0 if no motion blur needed. */
489 static inline uint object_motion_steps(BL::Object &b_parent,
490  BL::Object &b_ob,
491  const int max_steps = INT_MAX)
492 {
493  /* Get motion enabled and steps from object itself. */
494  PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
495  bool use_motion = get_boolean(cobject, "use_motion_blur");
496  if (!use_motion) {
497  return 0;
498  }
499 
500  int steps = max(1, get_int(cobject, "motion_steps"));
501 
502  /* Also check parent object, so motion blur and steps can be
503  * controlled by dupligroup duplicator for linked groups. */
504  if (b_parent.ptr.data != b_ob.ptr.data) {
505  PointerRNA parent_cobject = RNA_pointer_get(&b_parent.ptr, "cycles");
506  use_motion &= get_boolean(parent_cobject, "use_motion_blur");
507 
508  if (!use_motion) {
509  return 0;
510  }
511 
512  steps = max(steps, get_int(parent_cobject, "motion_steps"));
513  }
514 
515  /* Use uneven number of steps so we get one keyframe at the current frame,
516  * and use 2^(steps - 1) so objects with more/fewer steps still have samples
517  * at the same times, to avoid sampling at many different times. */
518  return min((2 << (steps - 1)) + 1, max_steps);
519 }
520 
521 /* object uses deformation motion blur */
522 static inline bool object_use_deform_motion(BL::Object &b_parent, BL::Object &b_ob)
523 {
524  PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
525  bool use_deform_motion = get_boolean(cobject, "use_deform_motion");
526  /* If motion blur is enabled for the object we also check
527  * whether it's enabled for the parent object as well.
528  *
529  * This way we can control motion blur from the dupligroup
530  * duplicator much easier.
531  */
532  if (use_deform_motion && b_parent.ptr.data != b_ob.ptr.data) {
533  PointerRNA parent_cobject = RNA_pointer_get(&b_parent.ptr, "cycles");
534  use_deform_motion &= get_boolean(parent_cobject, "use_deform_motion");
535  }
536  return use_deform_motion;
537 }
538 
540 {
541  for (BL::Modifier &b_mod : b_ob.modifiers) {
542  if (b_mod.is_a(&RNA_FluidModifier)) {
543  BL::FluidModifier b_mmd(b_mod);
544 
545  if (b_mmd.fluid_type() == BL::FluidModifier::fluid_type_DOMAIN &&
546  b_mmd.domain_settings().domain_type() == BL::FluidDomainSettings::domain_type_LIQUID) {
547  return b_mmd.domain_settings();
548  }
549  }
550  }
551 
553 }
554 
556 {
557  for (BL::Modifier &b_mod : b_ob.modifiers) {
558  if (b_mod.is_a(&RNA_FluidModifier)) {
559  BL::FluidModifier b_mmd(b_mod);
560 
561  if (b_mmd.fluid_type() == BL::FluidModifier::fluid_type_DOMAIN &&
562  b_mmd.domain_settings().domain_type() == BL::FluidDomainSettings::domain_type_GAS) {
563  return b_mmd.domain_settings();
564  }
565  }
566  }
567 
569 }
570 
572  bool preview,
573  bool experimental)
574 {
575  PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");
576 
577  if (cobj.data && b_ob.modifiers.length() > 0 && experimental) {
578  BL::Modifier mod = b_ob.modifiers[b_ob.modifiers.length() - 1];
579  bool enabled = preview ? mod.show_viewport() : mod.show_render();
580 
581  if (enabled && mod.type() == BL::Modifier::type_SUBSURF &&
582  RNA_boolean_get(&cobj, "use_adaptive_subdivision")) {
583  BL::SubsurfModifier subsurf(mod);
584 
585  if (subsurf.subdivision_type() == BL::SubsurfModifier::subdivision_type_CATMULL_CLARK) {
587  }
588  else {
590  }
591  }
592  }
593 
594  return Mesh::SUBDIVISION_NONE;
595 }
596 
598 {
599  PointerRNA cvisibility = RNA_pointer_get(&b_ob.ptr, "cycles_visibility");
600  uint flag = 0;
601 
602  flag |= get_boolean(cvisibility, "camera") ? PATH_RAY_CAMERA : 0;
603  flag |= get_boolean(cvisibility, "diffuse") ? PATH_RAY_DIFFUSE : 0;
604  flag |= get_boolean(cvisibility, "glossy") ? PATH_RAY_GLOSSY : 0;
605  flag |= get_boolean(cvisibility, "transmission") ? PATH_RAY_TRANSMIT : 0;
606  flag |= get_boolean(cvisibility, "shadow") ? PATH_RAY_SHADOW : 0;
607  flag |= get_boolean(cvisibility, "scatter") ? PATH_RAY_VOLUME_SCATTER : 0;
608 
609  return flag;
610 }
611 
612 class EdgeMap {
613  public:
615  {
616  }
617 
618  void clear()
619  {
620  edges_.clear();
621  }
622 
623  void insert(int v0, int v1)
624  {
625  get_sorted_verts(v0, v1);
626  edges_.insert(std::pair<int, int>(v0, v1));
627  }
628 
629  bool exists(int v0, int v1)
630  {
631  get_sorted_verts(v0, v1);
632  return edges_.find(std::pair<int, int>(v0, v1)) != edges_.end();
633  }
634 
635  protected:
636  void get_sorted_verts(int &v0, int &v1)
637  {
638  if (v0 > v1) {
639  swap(v0, v1);
640  }
641  }
642 
643  set<std::pair<int, int>> edges_;
644 };
645 
647 
648 #endif /* __BLENDER_UTIL_H__ */
typedef float(TangentPoint)[2]
unsigned int uint
Definition: BLI_sys_types.h:83
const char * dirname(char *path)
void swap(T &a, T &b)
Definition: Common.h:33
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
struct ID ID
struct CurveMapping CurveMapping
struct CurveMap CurveMap
struct FluidDomainSettings FluidDomainSettings
struct Image Image
struct ImageUser ImageUser
struct Mesh Mesh
struct Object Object
struct Scene Scene
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White ColorRamp
struct RenderResult RenderResult
StructRNA RNA_FluidModifier
static uint object_ray_visibility(BL::Object &b_ob)
Definition: blender_util.h:597
static float4 get_float4(const BL::Array< float, 4 > &array)
Definition: blender_util.h:310
float * BKE_image_get_float_pixels_for_frame(void *image, int frame, int tile)
static BL::FluidDomainSettings object_fluid_liquid_domain_find(BL::Object &b_ob)
Definition: blender_util.h:539
static uint object_motion_steps(BL::Object &b_parent, BL::Object &b_ob, const int max_steps=INT_MAX)
Definition: blender_util.h:489
static int render_resolution_x(BL::RenderSettings &b_render)
Definition: blender_util.h:227
static float get_float(PointerRNA &ptr, const char *name)
Definition: blender_util.h:359
void python_thread_state_restore(void **python_thread_state)
static bool BKE_object_is_deform_modified(BL::Object &self, BL::Scene &scene, bool preview)
Definition: blender_util.h:222
static void curvemapping_minmax(BL::CurveMapping &cumap, bool rgb_curve, float *min_x, float *max_x)
Definition: blender_util.h:143
static void set_boolean(PointerRNA &ptr, const char *name, bool value)
Definition: blender_util.h:354
static bool get_boolean(PointerRNA &ptr, const char *name)
Definition: blender_util.h:349
static void set_float3(PointerRNA &ptr, const char *name, float3 value)
Definition: blender_util.h:332
static unsigned char * image_get_pixels_for_frame(BL::Image &image, int frame, int tile)
Definition: blender_util.h:260
static bool BKE_object_is_modified(BL::Object &self, BL::Scene &scene, bool preview)
Definition: blender_util.h:217
unsigned char * BKE_image_get_pixels_for_frame(void *image, int frame, int tile)
static int get_int(PointerRNA &ptr, const char *name)
Definition: blender_util.h:369
static string get_enum_identifier(PointerRNA &ptr, const char *name)
Definition: blender_util.h:399
static string get_text_datablock_content(const PointerRNA &ptr)
Definition: blender_util.h:456
static void colorramp_to_array(BL::ColorRamp &ramp, array< float3 > &ramp_color, array< float > &ramp_alpha, int size)
Definition: blender_util.h:120
static void curvemapping_to_array(BL::CurveMapping &cumap, array< float > &data, int size)
Definition: blender_util.h:158
static float3 get_float3(const BL::Array< float, 2 > &array)
Definition: blender_util.h:295
static int render_resolution_y(BL::RenderSettings &b_render)
Definition: blender_util.h:232
static int get_enum(PointerRNA &ptr, const char *name, int num_values=-1, int default_value=-1)
Definition: blender_util.h:386
CCL_NAMESPACE_BEGIN typedef BL::ShaderNodeAttribute::attribute_type_enum BlenderAttributeType
Definition: blender_util.h:43
static void set_enum(PointerRNA &ptr, const char *name, int value)
Definition: blender_util.h:410
static void render_add_metadata(BL::RenderResult &b_rr, string name, string value)
Definition: blender_util.h:270
BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_real_name)
static void set_float4(PointerRNA &ptr, const char *name, float4 value)
Definition: blender_util.h:344
static int4 get_int4(const BL::Array< int, 4 > &array)
Definition: blender_util.h:320
void BKE_image_user_file_path(void *iuser, void *ima, char *path)
static void curvemapping_color_to_array(BL::CurveMapping &cumap, array< float3 > &data, int size, bool rgb_curve)
Definition: blender_util.h:169
static string blender_absolute_path(BL::BlendData &b_data, BL::ID &b_id, const string &path)
Definition: blender_util.h:438
static int3 get_int3(const BL::Array< int, 3 > &array)
Definition: blender_util.h:315
static float2 get_float2(const BL::Array< float, 2 > &array)
Definition: blender_util.h:290
static Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob, bool preview, bool experimental)
Definition: blender_util.h:571
static BL::Mesh object_to_mesh(BL::BlendData &, BL::Object &object, BL::Depsgraph &, bool, Mesh::SubdivisionType subdivision_type)
Definition: blender_util.h:49
void BKE_image_user_frame_calc(void *ima, void *iuser, int cfra)
static string image_user_file_path(BL::ImageUser &iuser, BL::Image &ima, int cfra, bool load_tiled)
Definition: blender_util.h:237
static void set_int(PointerRNA &ptr, const char *name, int value)
Definition: blender_util.h:374
static BL::FluidDomainSettings object_fluid_gas_domain_find(BL::Object &b_ob)
Definition: blender_util.h:555
static void free_object_to_mesh(BL::BlendData &, BL::Object &object, BL::Mesh &mesh)
Definition: blender_util.h:110
void python_thread_state_save(void **python_thread_state)
static void curvemap_minmax_curve(BL::CurveMap &curve, float *min_x, float *max_x)
Definition: blender_util.h:137
static string get_string(PointerRNA &ptr, const char *name)
Definition: blender_util.h:420
static void set_float(PointerRNA &ptr, const char *name, float value)
Definition: blender_util.h:364
static Transform get_transform(const BL::Array< float, 16 > &array)
Definition: blender_util.h:277
static bool object_use_deform_motion(BL::Object &b_parent, BL::Object &b_ob)
Definition: blender_util.h:522
static void mesh_texture_space(BL::Mesh &b_mesh, float3 &loc, float3 &size)
Definition: blender_util.h:473
static void set_string(PointerRNA &ptr, const char *name, const string &value)
Definition: blender_util.h:431
static int image_user_frame_number(BL::ImageUser &iuser, BL::Image &ima, int cfra)
Definition: blender_util.h:254
static float * image_get_float_pixels_for_frame(BL::Image &image, int frame, int tile)
Definition: blender_util.h:265
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
void clear()
Definition: blender_util.h:618
set< std::pair< int, int > > edges_
Definition: blender_util.h:643
void insert(int v0, int v1)
Definition: blender_util.h:623
bool exists(int v0, int v1)
Definition: blender_util.h:629
void get_sorted_verts(int &v0, int &v1)
Definition: blender_util.h:636
T * resize(size_t newsize)
Definition: util_array.h:150
Scene scene
Curve curve
const Depsgraph * depsgraph
#define str(s)
bool enabled
#define CCL_NAMESPACE_END
#define make_int4(x, y, z, w)
#define make_float2(x, y)
#define make_float4(x, y, z, w)
#define make_int3(x, y, z)
#define make_float3(x, y, z)
@ PATH_RAY_SHADOW
Definition: kernel_types.h:284
@ PATH_RAY_TRANSMIT
Definition: kernel_types.h:268
@ PATH_RAY_VOLUME_SCATTER
Definition: kernel_types.h:290
@ PATH_RAY_GLOSSY
Definition: kernel_types.h:270
@ PATH_RAY_DIFFUSE
Definition: kernel_types.h:269
@ PATH_RAY_CAMERA
Definition: kernel_types.h:266
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:6550
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6562
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:6272
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:6319
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:866
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:6378
void RNA_enum_set_identifier(bContext *C, PointerRNA *ptr, const char *name, const char *id)
Definition: rna_access.c:6425
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6308
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6355
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
Definition: rna_access.c:1925
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:6366
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3543
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:6413
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
Definition: rna_access.c:6390
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen)
Definition: rna_access.c:6527
static const int steps
Definition: sky_nishita.cpp:28
#define min(a, b)
Definition: sort.c:51
SubdivisionType
Definition: mesh.h:132
@ SUBDIVISION_NONE
Definition: mesh.h:133
@ SUBDIVISION_LINEAR
Definition: mesh.h:134
@ SUBDIVISION_CATMULL_CLARK
Definition: mesh.h:135
void * data
Definition: RNA_types.h:52
float x
Definition: sky_float3.h:35
float max
ccl_device_inline int mod(int x, int m)
Definition: util_math.h:405
string path_dirname(const string &path)
Definition: util_path.cpp:412
string path_join(const string &dir, const string &file)
Definition: util_path.cpp:426
ccl_device_inline Transform projection_to_transform(const ProjectionTransform &a)
ccl_device_inline ProjectionTransform projection_transpose(const ProjectionTransform &a)
void string_replace(string &haystack, const string &needle, const string &other)
PointerRNA * ptr
Definition: wm_files.c:3157