Commit: 29bf8d456e35e65b27f757e54e5fd0a998daffbd
Author: Antonio Vazquez
Date:   Wed Jun 13 16:18:12 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB29bf8d456e35e65b27f757e54e5fd0a998daffbd

Cleanup: More style changes

===================================================================

M       source/blender/blenkernel/BKE_object.h
M       source/blender/blenkernel/intern/object.c
M       source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===================================================================

diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index 720c8cda818..20b9cfd2c07 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -114,7 +114,7 @@ struct Object *BKE_object_add_from(
         ATTR_NONNULL(1, 2, 3, 6) ATTR_RETURNS_NONNULL;
 struct Object *BKE_object_add_for_data(
         struct Main *bmain, struct ViewLayer *view_layer,
-        int type, const char *name, struct ID *data, bool add_user) 
ATTR_RETURNS_NONNULL;
+        int type, const char *name, struct ID *data, bool do_id_user) 
ATTR_RETURNS_NONNULL;
 void *BKE_object_obdata_add_from_type(
         struct Main *bmain,
         int type, const char *name)
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index a4d38d74d31..4a0e3eff0c0 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -228,23 +228,24 @@ void BKE_object_modifier_hook_reset(Object *ob, 
HookModifierData *hmd)
 
 void BKE_object_modifier_gpencil_hook_reset(Object *ob, 
HookGpencilModifierData *hmd)
 {
+       if (hmd->object == NULL) {
+               return;
+       }
        /* reset functionality */
-       if (hmd->object) {
-               bPoseChannel *pchan = 
BKE_pose_channel_find_name(hmd->object->pose, hmd->subtarget);
+       bPoseChannel *pchan = BKE_pose_channel_find_name(hmd->object->pose, 
hmd->subtarget);
 
-               if (hmd->subtarget[0] && pchan) {
-                       float imat[4][4], mat[4][4];
+       if (hmd->subtarget[0] && pchan) {
+               float imat[4][4], mat[4][4];
 
-                       /* calculate the world-space matrix for the 
pose-channel target first, then carry on as usual */
-                       mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat);
+               /* calculate the world-space matrix for the pose-channel target 
first, then carry on as usual */
+               mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat);
 
-                       invert_m4_m4(imat, mat);
-                       mul_m4_m4m4(hmd->parentinv, imat, ob->obmat);
-               }
-               else {
-                       invert_m4_m4(hmd->object->imat, hmd->object->obmat);
-                       mul_m4_m4m4(hmd->parentinv, hmd->object->imat, 
ob->obmat);
-               }
+               invert_m4_m4(imat, mat);
+               mul_m4_m4m4(hmd->parentinv, imat, ob->obmat);
+       }
+       else {
+               invert_m4_m4(hmd->object->imat, hmd->object->obmat);
+               mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->obmat);
        }
 }
 
@@ -867,12 +868,12 @@ Object *BKE_object_add_from(
  *
  * \param data The datablock to assign as ob->data for the new object.
  *             This is assumed to be of the correct type.
- * \param add_user If true, id_us_plus() will be called on data when
+ * \param do_id_user If true, id_us_plus() will be called on data when
  *                 assigning it to the object.
  */
 Object *BKE_object_add_for_data(
         Main *bmain, ViewLayer *view_layer,
-        int type, const char *name, ID *data, bool add_user)
+        int type, const char *name, ID *data, bool do_id_user)
 {
        Object *ob;
        Base *base;
@@ -881,7 +882,7 @@ Object *BKE_object_add_for_data(
        /* same as object_add_common, except we don't create new ob->data */
        ob = BKE_object_add_only_object(bmain, type, name);
        ob->data = data;
-       if (add_user) id_us_plus(data);
+       if (do_id_user) id_us_plus(data);
        
        BKE_view_layer_base_deselect_all(view_layer);
        DEG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | 
OB_RECALC_TIME);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index bcdf560e60f..9e3412830c4 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1909,7 +1909,9 @@ void 
DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
                        */
                        TimeSourceKey time_key;
                        ComponentKey geometry_key(obdata, 
DEG_NODE_TYPE_GEOMETRY);
-                       add_relation(time_key, geometry_key, "GP Frame Change");
+                       add_relation(time_key, 
+                                                geometry_key, 
+                                                "GP Frame Change");
 
                        /* Geometry cache also needs to be recalculated when 
Material
                        * settings change (e.g. when fill.opacity changes 
on/off,
@@ -1917,11 +1919,13 @@ void 
DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
                        */
                        for (int i = 0; i < gpd->totcol; i++) {
                                Material *ma = gpd->mat[i];
-                               if ((ma) && (ma->gp_style)) {
+                               if ((ma != NULL) && (ma->gp_style != NULL)) {
                                        OperationKey material_key(&ma->id,
-                                               DEG_NODE_TYPE_SHADING,
-                                               DEG_OPCODE_MATERIAL_UPDATE);
-                                       add_relation(material_key, 
geometry_key, "Material -> GP Data");
+                                                                               
          DEG_NODE_TYPE_SHADING,
+                                                                     
DEG_OPCODE_MATERIAL_UPDATE);
+                                       add_relation(material_key, 
+                                                                geometry_key, 
+                                                                "Material -> 
GP Data");
                                }
                        }
                        break;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to